Elastic Search combination of Range and Term filters

Below query is working with range filter as well as term filter.

{
"size": 1,
"from": 0,
"sort": [
{
  "inDeviceDateTime": {
    "order": "desc"
  }
}
],
"query": {
"bool": {
  "must": {
    "range": {
      "inDeviceDateTime": {
        "gte": 1500316199000,
        "lte": 1500336000000
      }
    }
  },
  "must": {
    "term": {
      "inType": 3
    }
  },
  "must": [
    {
      "multi_match": {
        "query": "Mom",
        "fields": [
          "stFrom",
          "stTo"
        ]
      }
    }
  ]
  }
 }
}

Note: The filtered query has been replaced by the bool query in recent versions of ElasticSearch. See the docs for more info.

You are not the first person confused by the filtered query :)

 {
  "query": {
    "filtered": {
      "query": {
        "term": {
          "language_id": 28
        }
      },
      "filter": {
        "range": {
          "re_max": {
          "gt": 100
          }
        }
      }
    }
  }
}

Update: if you want to use both conditions as a combined filter, you can join them with bool or and filter, and omit the query part altogether. Example with and follows:

{
    "query":{
        "filtered":{
            "filter":{
                "and":[
                    {
                        "range":{
                            "re_max":{
                                "gt":100
                            }
                        }
                    },
                    {
                        "term":{
                            "language_id":28
                        }
                    }
                ]
            }
        }
    }
}

The "filtered" query was deprecated in 2.0 and removed in 5.0

Elasticsearch 5 and 6 filter can be used:

{
  "query": { 
    "bool": { 
      "filter": [ 
        { "term":  { "language_id": 28  }},
        { "term":  { "some_other_term": "some string value"}},
        { "range": { "created_at_timestamp": { "gt": "2015-01-01" }}} 
      ]
    }
  }
}