简体   繁体   English

如何加快es匹配查询性能

[英]how to speed up es match query performance

There is a company index with many records有一个公司索引有很多记录

health status index               uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   company             KTngnM6ASD-_KdU0FFAWRA   1   0   95185696     31780899     26.5gb         26.5gb

when execute match query执行匹配查询时

{
  "query": {
    "match": {
      "name": {
        "query": "some Chinese com name",
        "operator": "and"
      }
    }
  }
}

if use and operator sometimes cannot find any result (because not all word hit), but use or it takes more time if use and operator 有时找不到任何结果(因为不是所有单词都命中),但是使用or需要更多时间

eg search some words and took 3446 but or took 23650例如,搜索一些单词and3446or23650

If use or how to speed up response performance?如果使用or如何加快响应性能?

This sounds like your system is seriously undersized for your index.这听起来您的系统对于您的索引来说严重不足。 Consider upgrading your machine , especially memory and use SSDs.考虑升级您的机器,尤其是内存并使用 SSD。 Such simple queries should not take over 400-500ms.这种简单的查询不应超过 400-500 毫秒。 Sounds like your waiting for IO.听起来像是在等待 IO。 If you have enough memory to fit the index, you can run some warm up queries to load it into memory and do fast searches on it.如果您有足够的内存来容纳索引,您可以运行一些预热查询以将其加载到内存中并对其进行快速搜索。 You can also add more nodes to your cluster and increase the shard and replica count to split the load on these nodes.您还可以向集群添加更多节点并增加分片和副本数量以分摊这些节点上的负载。

If you are not in a position to upgrade the system, you can try to add some filters to your query to limit the number of documents that are matched.如果您无法升级系统,您可以尝试在查询中添加一些过滤器以限制匹配的文档数量。 This should also speed up your query time.这也应该加快您的查询时间。

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

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