简体   繁体   English

如何使用elastichsearch API有效地对大量数据执行搜索?

[英]How to perform searching on large amounts of data efficiently with elastichsearch apis?

I want to use elastichsearch for indexing and searching mechanisms in java. 我想使用elastichsearch在Java中建立索引和搜索机制。 My question is I don't know what I should do if there are large amounts of data in indexing and searching results. 我的问题是,如果索引和搜索结果中包含大量数据,我不知道该怎么办。

What is the proper searching api for big datas for real time user requests in elastich search? 用于弹性搜索中实时用户请求的大数据的正确搜索API是什么? Or do you have any idea about this? 还是对此有任何想法?

Thanks for help/comments. 感谢您的帮助/评论。

  • At indexing time, you have a bulk API dedicated to performs lots of operations in one single call. 在编制索引时,您将拥有一个bulk API, 专用于在一个调用中执行许多操作。

  • At search time, you only retrieve 10 results by default. 在搜索时,默认情况下仅检索10个结果。 You can use pagination by setting from / size parameters and to browse larger resultsets, you have a scroll API (documentation here) which is used a bit like a cursor with a DB. 您可以通过from / size参数进行设置来使用分页,并浏览较大的结果集,您有一个scroll API(此处的文档),其使用方式有点像DB的游标。

About the real time nature of your search, be aware that, the results are not visible immediately . 关于搜索的实时性质,请注意,结果不会立即可见。 you may have to wait up to 1s ( refresh_interval default value). 您可能需要等待最多1s( refresh_interval默认值)。 You can force this refresh operation or lower the refresh_interval parameter value, but this is costly and should be avoided when indexing lots of documents. 您可以强制执行此刷新操作或降低refresh_interval参数的值,但是这样做成本很高,因此在为大量文档建立索引时应避免这样做。

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

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