# Question about the implementation principle of post-filtering query for sparse vectors

**URL:** <https://discuss.elastic.co/t/question-about-the-implementation-principle-of-post-filtering-query-for-sparse-vectors/384540>\
**Category:** Elasticsearch\
**Created:** [January 14, 2026, 11:07am UTC](https://discuss.elastic.co/t/question-about-the-implementation-principle-of-post-filtering-query-for-sparse-vectors/384540 "2026-01-14T11:07:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ningsir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ningsir/32/146658_2.png) [@Ningsir](https://discuss.elastic.co/u/Ningsir)\
**Post date:** [January 14, 2026, 11:07am UTC](https://discuss.elastic.co/t/question-about-the-implementation-principle-of-post-filtering-query-for-sparse-vectors/384540/1 "2026-01-14T11:07:02Z")

</div>

For the implementation of sparse vector post filtering, is it to query all results and then perform post filtering, or to query k results and then perform post filtering.

```auto
{
  "query": {
    "bool": {
      "must": [{"sparse_vector": {...}}]
    }
  },
  "size": top_k,
  "post_filter": {"range": {"id": {"gte": start_id}}}
}

```

---

<div class="post-metadata">

**Author:** ![john-wagster](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john-wagster/32/139021_2.png) [@john-wagster](https://discuss.elastic.co/u/john-wagster)\
**Post date:** [January 14, 2026, 4:25pm UTC](https://discuss.elastic.co/t/question-about-the-implementation-principle-of-post-filtering-query-for-sparse-vectors/384540/2 "2026-01-14T16:25:21Z")

</div>

I wasn’t able to find docs to link to but I went and validated this behavior in code.

The evaluation in this case for your example occurs in this order: query → post\_filter → size

So if the query returns 10 results, post\_filter narrows that down to 5, and size limits it to 2 then you’ll get 2 results back total.

Hopefully that helps let me know if you have other questions!
