问题
when using the elastic search java client it is possible to specify the write consistency level and timeout for each query:
final IndexRequestBuilder indexRequestBuilder = client.prepareIndex("myIndex", "myType");
indexRequestBuilder.setConsistencyLevel(WriteConsistencyLevel.ALL);
indexRequestBuilder.setTimeout(TimeValue.timeValueMillis(500));
final XContentBuilder sourceBuilder = .....
indexRequestBuilder.setSource(sourceBuilder).execute().actionGet();
I did not find an API to do the same with Spring Data's ElasticSearchTemplate.
Do you know if there is a way?
回答1:
after checking with the spring folks at devoxx.be it looks like there isn't a way to specify write consistency and timeout per query with SpringData's ElasticSearchTemplate.
来源:https://stackoverflow.com/questions/40270756/is-there-a-way-to-specify-write-consistency-level-when-using-spring-datas-elast