elasticsearch - 如何在Kibana(ElasticSearch)中编写OR查询?

标签 elasticsearch kibana

通过Kibana使用ElasicSearch的JSON查询DSL,如何检索所有具有以下内容的文档:

  • messageTemplate等于My message
  • level等于Error
  • 最佳答案

    您必须为此使用Bool query:

    ... If the bool query is a filter context or has neither must or filter then at least one of the should queries must match a document for it to match the bool query


        POST <your_index>/_search 
        {
          "query": {
            "bool": {
              "should": [
    
                  { "match_phrase" : { "messageTemplate" : "My message" } },
                  { "term" : { "level" : "Error" } }
    
              ]
            }
          }
        }
    

    关于elasticsearch - 如何在Kibana(ElasticSearch)中编写OR查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51103614/

    相关文章:

    elasticsearch - Elasticsearch分拣领带

    python - Django:在单个应用程序中使用 MySQL 和 ElasticSearch

    python - 没有得到弹性的整数类型

    elasticsearch - EFK与Searchguard

    具有 3 个节点的 ElasticSearch 可用性/分区容差

    elasticsearch - 禁用对索引模板中不存在的字段的分析

    elasticsearch - flink-kafka-elasticsearch部署在 yarn 上

    elasticsearch - 使用Kibana从日志文件中按线程显示事件

    elasticsearch - ES查询以匹配数组中的所有元素

    elasticsearch - 如何在Kibana中以条形显示日志中的特定消息