Ashok Kumar N
Ashok Kumar N

Reputation: 573

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

Upvotes: 1

Views: 541

Answers (1)

Hatim Stovewala
Hatim Stovewala

Reputation: 1251

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"
            }
          }
        }
      ]
    }
  }
}

Upvotes: 2

Related Questions