# Es7.x querystring can't boost NOT query

**URL:** <https://discuss.elastic.co/t/es7-x-querystring-cant-boost-not-query/275653>\
**Category:** Elasticsearch\
**Created:** [June 11, 2021, 7:16am UTC](https://discuss.elastic.co/t/es7-x-querystring-cant-boost-not-query/275653 "2021-06-11T07:16:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![laigood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/laigood/32/30060_2.png) [@laigood](https://discuss.elastic.co/u/laigood)\
**Post date:** [June 11, 2021, 7:16am UTC](https://discuss.elastic.co/t/es7-x-querystring-cant-boost-not-query/275653/1 "2021-06-11T07:16:54Z")

</div>

I found that from es7.0,querystring query can't boost NOT query,like below code,the result score is 0,not 100 as expect.I alse check in es5.x and es6.x it work as expect.someone know why?

```auto
PUT test/_doc/1
{
  "test": "1"
}
GET test/_search
{
  "query": {
    "query_string": {
      "query": "(NOT _exists_:abc)^100"
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![lgxnu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lgxnu/32/90174_2.png) [@lgxnu](https://discuss.elastic.co/u/lgxnu)\
**Post date:** [June 11, 2021, 10:42am UTC](https://discuss.elastic.co/t/es7-x-querystring-cant-boost-not-query/275653/2 "2021-06-11T10:42:34Z")

</div>

I suffered from this issue as well, and think it 's a big problem which lead to incorrect boost score, hope it could be solved as soon as possible.

---

<div class="post-metadata">

**Author:** ![laigood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/laigood/32/30060_2.png) [@laigood](https://discuss.elastic.co/u/laigood)\
**Post date:** [June 18, 2021, 7:45am UTC](https://discuss.elastic.co/t/es7-x-querystring-cant-boost-not-query/275653/3 "2021-06-18T07:45:28Z")

</div>

I finally found the problem,about this commit.

> <https://github.com/elastic/elasticsearch/commit/aeac6828699c12c0d54a8537af806b824c08ebff>
>
> It would make them consistent with queries that are only made of filters.
> 
> Clo…ses #23449

it change BooleanClause.Occur.MUST to BooleanClause.Occur.FILTER in fixNegativeQueryIfNeeded,that result in the score become 0

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 16, 2021, 7:46am UTC](https://discuss.elastic.co/t/es7-x-querystring-cant-boost-not-query/275653/4 "2021-07-16T07:46:03Z")

</div>

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