I am using Elasticsearch 2.3 (both server and client).
I added some indexes using below mention code:
private TransportClient txClient;
// client connection code
IndexResponse response = txClient.prepareIndex(some_values).setSource(some_value)
.execute().actionGet();
assert response.getId() != null;
Immediately after addition, I searched for that index using SearchRequestBuilder
.
SearchResponse response = txClient.prepareSearch(some_values).setTypes(some_value)
.execute().actionGet();
I did not get newly added indexes.
All I want to wait until all the indexes are added. How can I achieve that?
EDIT :
After adding .setRefresh(true)
to the prepareIndex()
method, my problem is solved. But as far as I understand, it's not good for performance.
I did not want to refresh it immediately, I want to wait till all the indexes are created in the normal way.