Is there a way to specify write consistency level when using spring data's ElasticSearchTemplate?

强颜欢笑 提交于 2019-12-12 04:28:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!