Use of filtered query?


I went through following query

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

The filtered query is used to filter the result set .

In the above query,after finding the yesterday's documents the filtered query is used to get the documents that match the particular field(i.e.tweet).

Correct me if my understanding is wrong.


Since this is a post_filter after match query the filter works ..


a post filter is applied after the search is executed, so it only makes sense to filter out documents there, not to execute another query, because the post filter does not apply scoring - this part needs to go into your regular query. See

Unless you are using aggregrations, there is no need for the post filter.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.