elasticSearch

批量插入bulk
批量搜索msearch如下,没有什么优势,批量的query越多,速度反而更慢,特喵的

原因可以参考下https://discuss.elastic.co/t/-msearch-vs--search/85983/2

A single search -- whether it comes from one of the MSearch items, or a regular single search -- will grab a thread from the search threadpool. The search threadpool defaults to the num_processors * 3. If all those threads are busy, any other search (single or msearch items) will pend until a thread is busy.

So basically, if you're hitting your cluster with 40k searches, it's entirely likely that users will see increased latency, as all search requests have the same "priority" in Elasticsearch, and they may end up waiting for a free thread.

 坑:search会默认return 10个结果,想要全部结果,用helplers.scan方法
如果插入数据很多,要设置好es的堆内存,要不然插入的时候会爆炸,具体做法如下:
 

 

posted @ 2019-05-27 17:46  simple_wxl  阅读(503)  评论(0编辑  收藏  举报