在使用弹簧数据的ElasticSearchTemplate时,有没有办法指定写入一致性级别? [英] Is there a way to specify write consistency level when using spring data's ElasticSearchTemplate?

查看:340
本文介绍了在使用弹簧数据的ElasticSearchTemplate时,有没有办法指定写入一致性级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用弹性搜索java客户端时,可以为每个查询指定写入一致性级别和超时值:

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();






我没有找到一个API做同样的事情使用Spring Data的ElasticSearchTemplate。


I did not find an API to do the same with Spring Data's ElasticSearchTemplate.

你知道有没有办法?

推荐答案

检查与devoxx的春天的人。它看起来像没有一种方式来指定与SpringData的ElasticSearchTemplate的每个查询的一致性和超时。

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.

这篇关于在使用弹簧数据的ElasticSearchTemplate时,有没有办法指定写入一致性级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆