Term Query

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

{
  "term" : { "user" : "Kimchy" }
}

Terms Query

Filters documents that have fields that match any of the provided terms (not analyzed).

GET /_search
{
  "constant_score" : {
    "filter" : {
      "terms" : { "user" : [ "kimchy", "elasticsearch" ] }
      }
    }
}

Range Query

GET _search
{
  "query" : {
    "range" : {
      "age" : {
        "gte" : 10,
        "lte" : 20,
        "boost" : 2.0
      }
    }
  }
}

Nested Query

Sampling mapping:

PUT /my_index
{
    "mappings": {
        "type1" : {
            "properties" : {
                "obj1" : {
                    "type" : "nested"
                }
            }
        }
    }
}
GET /_search
{
    "query": {
        "nested" : {
            "path" : "obj1",
            "score_mode" : "avg",
            "query" : {
                "bool" : {
                    "must" : [
                    { "match" : {"obj1.name" : "blue"} },
                    { "range" : {"obj1.count" : {"gt" : 5}} }
                    ]
                }
            }
        }
    }
}

results matching ""

    No results matching ""