# Enable\_position\_increments not working for phrase queries with stopwords

**URL:** <https://discuss.elastic.co/t/enable-position-increments-not-working-for-phrase-queries-with-stopwords/186323>\
**Category:** Elasticsearch\
**Created:** [June 18, 2019, 5:39pm UTC](https://discuss.elastic.co/t/enable-position-increments-not-working-for-phrase-queries-with-stopwords/186323 "2019-06-18T17:39:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![theonlykai](https://avatars.discourse-cdn.com/v4/letter/t/3be4f8/32.png) [@theonlykai](https://discuss.elastic.co/u/theonlykai)\
**Post date:** [June 18, 2019, 5:39pm UTC](https://discuss.elastic.co/t/enable-position-increments-not-working-for-phrase-queries-with-stopwords/186323/1 "2019-06-18T17:39:31Z")

</div>

I'm following this guide [https://stackoverflow.com/questions/31719249/how-to-query-a-phrase-with-stopwords-in-elasticsearch](https://stackoverflow.com/questions/31719249/how-to-query-a-phrase-with-stopwords-in-elasticsearch) to run phrase queries against text with stopwords removed, and the verified answer doesn't work in Elasticsearch 7. Setting enable\_position\_increments to false in my query\_string query doesn't do anything at all.

```auto
PUT /fr_articles
{
   "settings": {
      "analysis": {
         "analyzer": {
            "stop": {
               "type": "standard",
               "stopwords" : ["the"]
            }
         }
      }
   },
   "mappings": {
      "properties": {
            "title": {
               "type": "text",
               "analyzer": "stop"
            }
         }
   }
}

```

```auto
POST /fr_articles/test/1
{
    "title" : "Tom the king of Toulon!"
}

```

```auto
POST /fr_articles/_search
{
   "query": {
      "query_string": {
         "default_field": "title",
         "query" : "\"tom king\"",
         "enable_position_increments": false
      }
   }
}

```

This returns 0 results.

I don't want to use slop because then you lose control over what's the word that gets between the two other words.

---

<div class="post-metadata">

**Author:** ![bdecarne](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bdecarne/32/48439_2.png) [@bdecarne](https://discuss.elastic.co/u/bdecarne)\
**Post date:** [June 20, 2019, 12:25pm UTC](https://discuss.elastic.co/t/enable-position-increments-not-working-for-phrase-queries-with-stopwords/186323/2 "2019-06-20T12:25:33Z")

</div>

Hi there,

I'm facing the same problem today... Same example, same version, same unexpected behavior...

Maybe we misunderstood the `enable_position_increments` option in query\_string ?

Thanks for any help !

---

<div class="post-metadata">

**Author:** ![theonlykai](https://avatars.discourse-cdn.com/v4/letter/t/3be4f8/32.png) [@theonlykai](https://discuss.elastic.co/u/theonlykai)\
**Post date:** [June 28, 2019, 8:45am UTC](https://discuss.elastic.co/t/enable-position-increments-not-working-for-phrase-queries-with-stopwords/186323/3 "2019-06-28T08:45:45Z")

</div>

I wish someone from the Elastic or Lucene team would clarify this ☹

---

<div class="post-metadata">

**Author:** ![bdecarne](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bdecarne/32/48439_2.png) [@bdecarne](https://discuss.elastic.co/u/bdecarne)\
**Post date:** [June 28, 2019, 9:32am UTC](https://discuss.elastic.co/t/enable-position-increments-not-working-for-phrase-queries-with-stopwords/186323/4 "2019-06-28T09:32:16Z")

</div>

Hi ! The question has been answered here : [https://github.com/elastic/elasticsearch/issues/43574](https://github.com/elastic/elasticsearch/issues/43574)

Have a nice day !

---

<div class="post-metadata">

**Author:** ![theonlykai](https://avatars.discourse-cdn.com/v4/letter/t/3be4f8/32.png) [@theonlykai](https://discuss.elastic.co/u/theonlykai)\
**Post date:** [June 29, 2019, 3:03pm UTC](https://discuss.elastic.co/t/enable-position-increments-not-working-for-phrase-queries-with-stopwords/186323/5 "2019-06-29T15:03:59Z")

</div>

From the issue it looks like it was a bug?

---

<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 27, 2019, 3:04pm UTC](https://discuss.elastic.co/t/enable-position-increments-not-working-for-phrase-queries-with-stopwords/186323/6 "2019-07-27T15:04:01Z")

</div>

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