elasticsearch-river-mongodb icon indicating copy to clipboard operation
elasticsearch-river-mongodb copied to clipboard

mongodb.options.import_all_collections forces index.type value to source collection name

Open Guibod opened this issue 10 years ago • 2 comments

Hi,

Everything is in the title. For commodity sake and for home-made sharding purpose, my source database provides many collections that are push to ElasticSearch with a _type equal to my source collection. My frontend elasticsearch (elastica) client requires me to declare ALL types, that is a NO GO.

Could it be possible to change current behavior and honor index.type configuration value if present ? Keeping actual behavior if index.type is left blank ?

Thanks for this very nice tool, it help me a lot.

Guibod avatar Jan 10 '15 23:01 Guibod

private Timestamp<?> processBlockingQueue(QueueEntry entry) {
        // snip
        String type;
        if (definition.isImportAllCollections()) {
            type = entry.getCollection();
        } else {
            type = definition.getTypeName();
        }

Guibod avatar Jan 10 '15 23:01 Guibod

The field is never left null or empty, and forced to mongodb.db if missing.

I'd suggest a new boolean field to change this behavior. I'll try to submit a pull-request if my java skills allow that.

Guibod avatar Jan 11 '15 00:01 Guibod