[英]How to search data in elastic search from JAVA
I am using elastic search in my project, for searching we have genreally 2 methods:- 我在我的项目中使用弹性搜索,对于搜索,我们通常有2种方法:-
What is the difference between the two methods? 两种方法有什么区别? And, which one is more efficient?
而且,哪个更有效?
Thanks in advance 提前致谢
Prepare Search : 准备搜索 :
setQuery()
method. setQuery()
方法中指定的查询匹配的文档。 You can also pass filter
as per your requirement. filter
。 PrepareGet : PrepareGet :
findByid()
. findByid()
。 You have to specify the id of the document to be fetched. The Get operation gets hashed into a specific shard id. Get操作将散列到特定的分片ID中。 It then gets redirected to one of the replicas within that shard id and returns the result.
然后将其重定向到该分片ID内的副本之一,并返回结果。
PrepareGet
is more efficient as it fetches the data on the basis of id. PrepareGet
效率更高,因为它基于id来获取数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.