# "AND (null) AND" in query string

**URL:** https://discuss.elastic.co/t/and-null-and-in-query-string/154247
**Category:** Elasticsearch
**Created:** [October 26, 2018, 6:23pm UTC](https://discuss.elastic.co/t/and-null-and-in-query-string/154247 "2018-10-26T18:23:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jz1603](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jz1603](https://discuss.elastic.co/u/jz1603)
#### Post date: [October 26, 2018, 6:23pm UTC](https://discuss.elastic.co/t/and-null-and-in-query-string/154247/1 "2018-10-26T18:23:01Z")

</div>

Hi there,

We have recently upgraded from Elasticsearch 1.6 to 6.2, and a query string that used to work have stopped working.

the query looks like this:  
{  
"query": {  
"bool": {  
"must": {  
"query\_string": {  
"default\_operator": "AND",  
"query": "paper AND & AND pencil"  
}  
}  
}  
}  
}

Using the explain endpoint we were able to find out that the ampersand always gets stripped from the query string before being searched, so it becomes "paper AND AND pencil". In the previous version 1.6, the search was able to still return results with the two other words. However in the new version, ES is searching the null value between the ANDs and will not return any results.

Is this expected behaviour for the new version?

Thanks in advance!  
Jenna

---

<div class="post-metadata">

### Author: ![jimczi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jimczi/32/47985_2.png) [@jimczi](https://discuss.elastic.co/u/jimczi)
#### Post date: [October 26, 2018, 7:15pm UTC](https://discuss.elastic.co/t/and-null-and-in-query-string/154247/2 "2018-10-26T19:15:32Z")

</div>

This is a bug and the fix has been released in es 6.3:

> <https://github.com/elastic/elasticsearch/pull/28871>

  
You should upgrade to the latest 6x 😉

---

<div class="post-metadata">

### Author: ![jz1603](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jz1603](https://discuss.elastic.co/u/jz1603)
#### Post date: [November 1, 2018, 5:52pm UTC](https://discuss.elastic.co/t/and-null-and-in-query-string/154247/3 "2018-11-01T17:52:11Z")

</div>

Thank you so much for your help! 🙂

---

<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: [November 29, 2018, 5:52pm UTC](https://discuss.elastic.co/t/and-null-and-in-query-string/154247/4 "2018-11-29T17:52:12Z")

</div>

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