Term Query

edit

The term query finds documents that contain the exact term specified in the inverted index. For instance:

POST _search
{
  "query": {
    "term" : { "user" : "Kimchy" } 
  }
}

Finds documents which contain the exact term Kimchy in the inverted index of the user field.

A boost parameter can be specified to give this term query a higher relevance score than another query, for instance:

GET _search
{
  "query": {
    "bool": {
      "should": [
        {
          "term": {
            "status": {
              "value": "urgent",
              "boost": 2.0 
            }
          }
        },
        {
          "term": {
            "status": "normal" 
          }
        }
      ]
    }
  }
}

The urgent query clause has a boost of 2.0, meaning it is twice as important as the query clause for normal.

The normal clause has the default neutral boost of 1.0.