0
votes

I've read Elastic Search documentation but I can not understand how this query works. I just want to know how is the combination of query and filter and another filter.

{
  "query": {
    "filtered": { 
      "query": {
        "match": { "tweet": "full text search" }
      },
      "filter": {
        "range": { "created": { "gte": "now - 1d / d" }}
      }
    }
  }
}

Is it possible to explain it to me a bit simpler that this page? http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-filtered-query.html

1

1 Answers

2
votes

There is only one query and one filter:

  1. The query part is {"query": {"match": {"tweet": "full text search" }}}.
  2. The filter part is {"filter": {"range": {"created": {......}}}}.

To insert a filter into a query, we have to use filtered query DSL.(Note that it is the past participle of "filter".) A filtered query is something like:

{"query": {"filtered": {"query": ......}, {"filter": ......} }}

Just write any query under the second "query" part, any filter under the "filter" part.