简体   繁体   English

弹性搜索获取与操作获取

[英]Elastic Search get vs action get

What is the difference between elastic search get vs action get? 弹性搜索获取与动作获取之间有什么区别?

Is it just that one exposes the exceptions where as the other one handles them itself? 难道只是一个人在其他人自己处理的情况下就公开了例外?

All the usage examples with elastic search that I see (in Java) use actionGet, ie 我看到的(在Java中)所有带有弹性搜索的用法示例都使用actionGet,即

SearchResponse response = client.prepareSearch().execute().actionGet();

Which one should I be using and when? 我应该使用哪一个?何时使用?

FromThe official javaDocs of actionGet() 来自官方的javadocs of actionGet()

Similar to {@link #get()}, just catching the {@link InterruptedException} and throwing * an {@link org.elasticsearch.ElasticsearchIllegalStateException} instead. 与{@link #get()}类似,只是捕获{@link InterruptedException}并抛出一个{@link org.elasticsearch.ElasticsearchIllegalStateException}。 Also catches * {@link java.util.concurrent.ExecutionException} and throws the actual cause instead. 还捕获* {@link java.util.concurrent.ExecutionException}并引发实际原因。

It just provides a wrapper over Future#get() , catches InterruptedException, ExecutionException and wraps them into ElasticSearchException 它只是提供了对Future#get()的包装,捕获了InterruptedException, ExecutionException并将它们包装到ElasticSearchException

Also, you can directly use client.prepareSearch().get() instead of client.prepareSearch().execute().actionGet() . 另外,您可以直接使用client.prepareSearch().get()代替client.prepareSearch().execute().actionGet() It internally does the same. 它在内部执行相同的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM