Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Possible Bug: Bulk operation doesn't use defaultType value #78

Closed
pulkitsinghal opened this issue Oct 29, 2013 · 1 comment
Closed

Possible Bug: Bulk operation doesn't use defaultType value #78

pulkitsinghal opened this issue Oct 29, 2013 · 1 comment
Labels

Comments

@pulkitsinghal
Copy link

I setup my code like so:

Builder bulkIndexBuilder = new Bulk.Builder()
        .defaultIndex("my_index_name")
        .defaultType("my_index_type");
...
for (...) {
    Index index = new Index.Builder(source)
                            .id(id)
                            .build();
    bulkIndexBuilder = bulkIndexBuilder.addAction(index);
}
...
Bulk bulk = bulkIndexBuilder.build();
client.execute(bulk);

But what I get back is something like:

"items": [
    {
        "index": {
            "_index": "my_index_name", 
            "_type": "_all", 
            "_id": "...", 
            "error": "InvalidTypeNameException[mapping type name [_all] can't start with '_']"
        }
    },
...
]

Which means the defaultType value of my_index_type that I had setup wasn't used!
Looks like a bug to me ... am I mistaken?

@kramer
Copy link
Member

kramer commented Oct 29, 2013

You are right this is a bug, AbstractDocumentTargetedAction.Builder was too smart for its own good and set the type parameter to "_all" by default and this caused defaultType to be ineffective.

@kramer kramer closed this as completed in 910b075 Oct 29, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants