简体   繁体   中英

How to do term query in elastic-search?

     {
            "_index": "application-log",
            "_type": "test-engine",
            "_id": "AV9VzAc7lm36MlYWpRYH",
            "_score": 1,
            "_source": {
                "@timestamp": "2017-10-25T23:09:15.203+0000",
                "message": "Initiating connection to node -1 at 107.23.134.14:9092.",
                "host": "54.205.134.57",
                "severity": "DEBUG",
                "thread": "Thread-4",
                "logger": "org.apache.kafka.clients.NetworkClient"
            }
        }

I'm a beginner for elastic-search, I need a query for logger=org.apache.kafka.clients.NetworkClient

You can query like this using curl.

curl -XGET "http://localhost:9200/application-log/eportal-engine/_search" -H 'Content-Type: application/json' -d'
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "logger.keyword": {
              "value": "org.apache.kafka.clients.NetworkClient"
            }
          }
        }
      ]
    }
  }
}'

Kibana equivalent of the above query :

GET application-log/eportal-engine/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "logger.keyword": {
              "value": "org.apache.kafka.clients.NetworkClient"
            }
          }
        }
      ]
    }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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