elasticsearch - 如何在此Elasticsearch查询中添加其他条件进行过滤?

标签 elasticsearch elasticsearch-plugin

我有一个对business_process字段进行过滤的elasticsearch查询。我想添加另一个match子句,以便两个字段都具有指定的数据,并且我想在business_process字段上添加突出显示。我该怎么做呢?先感谢您。

{
  "query": {
    "filtered": {
      "query": {
        "match": {
          "business_process": "loading"
        }
      },
      "filter": {
        "missing": {
          "field": "client_cru_all"
        }
      }
    }
  }
}

最佳答案

ES文档是您的 friend 。 bool query可能就是您想要的。这样的事情应该做你想要的。

POST /test_index/_search
{
   "query": {
      "filtered": {
         "query": {
            "bool": {
               "must": [
                  {
                     "match": {
                        "business_process": "loading"
                     }
                  },
                  {
                     "match": {
                        "another_field": "some text"
                     }
                  }
               ]
            }
         },
         "filter": {
            "missing": {
               "field": "client_cru_all"
            }
         }
      }
   }
}

就突出显示而言,我将开始here。如果您无法使用它,请发布您在问题中尝试过的内容。

关于elasticsearch - 如何在此Elasticsearch查询中添加其他条件进行过滤?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33531807/

相关文章:

regex - 使用Elastic Search检索标签内容和带连字符的单词

elasticsearch - Logstash Elasticsearch 输入 - 仅运行一次?

java - Elasticsearch 从所有文档中获取某个字段的值

amazon-web-services - 在 Amazon ElasticBeanstalk 中使用 docker 或自定义 AMI

amazon-web-services - Logstash:将消息批量大小限制为 10MB

node.js - ElasticSearch - 未刷新索引更改

elasticsearch - 如何在Windows的Elasticsearch上安装watcher?

elasticsearch - 如何在 Elasticsearch Query 中传递特定字段的值列表

python - elasticsearch python 查询 - 按字段分组然后计数

elasticsearch - 更新要映射到Elasticsearch索引的数据的映射属性