Reputation: 49
I need to index multiple documents in bulk with making them available to search as soon as possible. So, I want to use refresh in order to suffice this requirement.
I am currently using the code like this below. Taking example from official site
def gendata():
mywords = ['foo', 'bar', 'baz']
for word in mywords:
yield {
"_index": "mywords",
"_type": "document",
"doc": {"word": word},
}
bulk(es, gendata())
I wish to attach a refresh=true to make it visible instantly.
Can you please help me know of this is possible with python bulk API?
Upvotes: 2
Views: 3587
Reputation: 1622
You can use the refresh
parameter:
bulk(es, gendata(), refresh="true")
The bulk
function documentation does not mention this parameter, but it is described in the bulk
method documentation.
Basically, the bulk
method has a refresh
parameter; available values are:
For more details, have a look at this question.
Upvotes: 4