# Query\_string not working after updating from 1.7 to 2.4

**URL:** <https://discuss.elastic.co/t/query-string-not-working-after-updating-from-1-7-to-2-4/67497>\
**Category:** Elasticsearch\
**Created:** [November 29, 2016, 2:27pm UTC](https://discuss.elastic.co/t/query-string-not-working-after-updating-from-1-7-to-2-4/67497 "2016-11-29T14:27:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romain\_Giovanetti](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@Romain\_Giovanetti](https://discuss.elastic.co/u/Romain_Giovanetti)\
**Post date:** [November 29, 2016, 2:27pm UTC](https://discuss.elastic.co/t/query-string-not-working-after-updating-from-1-7-to-2-4/67497/1 "2016-11-29T14:27:10Z")

</div>

Hello,

Since I updated my cluster from 1.7 to 2.4 the query\_string query stopped working.

However the term query still works.

Let's say I put 3 documents in the "us" index :

```
curl -XPUT 'http://localhost:9200/us/tweet/10?pretty=1' -d '
{
   "date" : "2014-09-20",
   "name" : "John Smith",
   "tweet" : "Elasticsearch surely is one of the hottest new NoSQL products",
   "user_id" : 1
}
'
curl -XPUT 'http://localhost:9200/us/tweet/12?pretty=1' -d '
{
   "date" : "2014-09-22",
   "name" : "John Smith",
   "tweet" : "Elasticsearch and I have left the honeymoon stage, and I still love her.",
   "user_id" : 1
}
'
curl -XPUT 'http://localhost:9200/us/tweet/4?pretty=1' -d '
{
   "date" : "2014-09-14",
   "name" : "John Smith",
   "tweet" : "@mary it is not just text, it does everything",
   "user_id" : 1
}
'

```

Then if I execute the following query :

```
{
"query": {
"bool": {
"must": [
{
"query_string": {
"default_field": "tweet.tweet",
"query": "elasticsearch"
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"aggs": { }
}

```

I get

```
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}

```

I can't figure out why.

I checked the logs and I see nothing wrong.

Can you help me?

Thanks

---

<div class="post-metadata">

**Author:** ![prasad\_kp](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@prasad\_kp](https://discuss.elastic.co/u/prasad_kp)\
**Post date:** [November 29, 2016, 3:23pm UTC](https://discuss.elastic.co/t/query-string-not-working-after-updating-from-1-7-to-2-4/67497/2 "2016-11-29T15:23:51Z")

</div>

HI Romain,giovanetti

GET us/tweet/\_search  
{  
"query": {  
"bool": {  
"must": [  
{  
"query\_string": {  
"default\_field": "tweet",  
"query": "elasticsearch"  
}  
}  
]  
}

}  
}

Could you please check with this one.

---

<div class="post-metadata">

**Author:** ![Romain\_Giovanetti](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@Romain\_Giovanetti](https://discuss.elastic.co/u/Romain_Giovanetti)\
**Post date:** [November 29, 2016, 3:39pm UTC](https://discuss.elastic.co/t/query-string-not-working-after-updating-from-1-7-to-2-4/67497/3 "2016-11-29T15:39:33Z")

</div>

😩

I tried your solution and it worked....

Then I tried my solution again and it worked too.

I don't understand 😕

Sometimes it works and sometimes not...

I use the indices.fielddata.cache.size setting (30%), could it be the problem ?

---

<div class="post-metadata">

**Author:** ![Romain\_Giovanetti](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@Romain\_Giovanetti](https://discuss.elastic.co/u/Romain_Giovanetti)\
**Post date:** [November 29, 2016, 3:46pm UTC](https://discuss.elastic.co/t/query-string-not-working-after-updating-from-1-7-to-2-4/67497/4 "2016-11-29T15:46:54Z")

</div>

> [@Romain\_Giovanetti](#):
>
> curl -XPUT '[http://localhost:9200/us/tweet/4?pretty=1](http://localhost:9200/us/tweet/4?pretty=1)' -d '  
> {  
> "date" : "2014-09-14",  
> "name" : "John Smith",  
> "tweet" : "@mary it is not just text, it does everything",  
> "user\_id" : 1  
> }  
> '

I'm starting to figure out that it works when I use a GET but the results are false

The Head plugin gives me the following URL

[http://localhost:9200/us/tweet/\_search?{"query":{"bool":{"filter":[{"query\_string":{"default\_field":"tweet.tweet","query":"elasticsearch"}](http://localhost:9200/us/tweet/_search?%7B%22query%22:%7B%22bool%22:%7B%22filter%22:%5B%7B%22query_string%22:%7B%22default_field%22:%22tweet.tweet%22,%22query%22:%22elasticsearch%22%7D)}],%22must\_not%22:,%22should%22:}},%22from%22:0,%22size%22:10,%22sort%22:,%22aggs%22:{}}

and it returns all the documents including :

```
{
"_index": "us",
"_type": "tweet",
"_id": "4",
"_score": 1,
"_source": {
"date": "2014-09-14",
"name": "John Smith",
"tweet": "@mary it is not just text, it does everything",
"user_id": 1
}
}

```

which doesn't contain the word "elasticsearch"

EDIT: your solution using POST works

EDIT2: it seems that all my issues were related to the name used for the fields (tweet.tweet vs tweet).

Thank you for your help

And sorry for this stupid question, I feel tired

---

<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:** [December 27, 2016, 3:47pm UTC](https://discuss.elastic.co/t/query-string-not-working-after-updating-from-1-7-to-2-4/67497/5 "2016-12-27T15:47:04Z")

</div>

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