# Query\_string\_query problem with multi fields

**URL:** <https://discuss.elastic.co/t/query-string-query-problem-with-multi-fields/17325>\
**Category:** Elasticsearch\
**Created:** [May 2, 2014, 10:03pm UTC](https://discuss.elastic.co/t/query-string-query-problem-with-multi-fields/17325 "2014-05-02T22:03:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![seallison](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@seallison](https://discuss.elastic.co/u/seallison)\
**Post date:** [May 2, 2014, 10:03pm UTC](https://discuss.elastic.co/t/query-string-query-problem-with-multi-fields/17325/1 "2014-05-02T22:03:41Z")

</div>

Hey I recently ran in to an issues that seemed to work in the 0.90.x series  
that doesn't seem to work the same way in the current version of  
Elasticsearch 1.1.1. The issue is prefacing the fields with the type.

Create some data:

curl -XPUT localhost:9200/junk/junk/1 -d  
'{"person":{"name":{"\_id":"1","first":"Joe"},"address":{"\_id":"abcd","line1":"444  
Joe Empire","line2":"Suite 100"}}}'

curl -XPUT localhost:9200/junk/junk/2 -d  
'{"person":{"name":{"\_id":"1","first":"Jack"},"address":{"\_id":"abcd","line1":"444  
Joe Empire","line2":"Suite 100"}}}'

$ curl -XGET 'localhost:9200/junk/junk/\_search?pretty' -d '{ "query": {  
"query\_string": { "use\_dis\_max": true, "query": "joe", "fields":  
["person.name._^1.2", "person.address._^1.1"] } } }'  
{  
"took" : 1,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 2,  
"max\_score" : 0.09415865,  
"hits" : [ {  
"\_index" : "junk",  
"\_type" : "junk",  
"\_id" : "1",  
"\_score" : 0.09415865, "\_source" :  
{"person":{"name":{"\_id":"1","first":"Joe"},"address":{"\_id":"abcd","line1":"444  
Joe Empire","line2":"Suite 100"}}}  
}, {  
"\_index" : "junk",  
"\_type" : "junk",  
"\_id" : "2",  
"\_score" : 0.043156046, "\_source" :  
{"person":{"name":{"\_id":"1","first":"Jack"},"address":{"\_id":"abcd","line1":"444  
Joe Empire","line2":"Suite 100"}}}  
} ]  
}  
}

# Why does this not work?

$ curl -XGET 'localhost:9200/junk/junk/\_search?pretty' -d '{ "query": {  
"query\_string": { "use\_dis\_max": true, "query": "joe", "fields":  
["junk.person.name._^1.2", "junk.person.address._^1.1"] } } }'  
{  
"took" : 1,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 0,  
"max\_score" : null,  
"hits" : []  
}  
}

# I have to use the fully qualified field to get hits now...

$ curl -XGET 'localhost:9200/junk/junk/\_search?pretty' -d '{ "query": {  
"query\_string": { "use\_dis\_max": true, "query": "joe", "fields":  
["junk.person.name.first^1.2", "junk.person.address.\*^1.1"] } } }'  
{  
"took" : 1,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 1,  
"max\_score" : 0.30685282,  
"hits" : [ {  
"\_index" : "junk",  
"\_type" : "junk",  
"\_id" : "1",  
"\_score" : 0.30685282, "\_source" :  
{"person":{"name":{"\_id":"1","first":"Joe"},"address":{"\_id":"abcd","line1":"444  
Joe Empire","line2":"Suite 100"}}}  
} ]  
}  
}

$ curl -XGET 'localhost:9200/junk/junk/\_search?pretty' -d '{ "query": {  
"query\_string": { "use\_dis\_max": true, "query": "joe", "fields":  
["junk.person.name.first^1.2", "junk.person.address.line1^1.1"] } } }'  
{  
"took" : 1,  
"timed\_out" : false,  
"\_shards" : {  
"total" : 5,  
"successful" : 5,  
"failed" : 0  
},  
"hits" : {  
"total" : 2,  
"max\_score" : 0.30685285,  
"hits" : [ {  
"\_index" : "junk",  
"\_type" : "junk",  
"\_id" : "1",  
"\_score" : 0.30685285, "\_source" :  
{"person":{"name":{"\_id":"1","first":"Joe"},"address":{"\_id":"abcd","line1":"444  
Joe Empire","line2":"Suite 100"}}}  
}, {  
"\_index" : "junk",  
"\_type" : "junk",  
"\_id" : "2",  
"\_score" : 0.04315605, "\_source" :  
{"person":{"name":{"\_id":"1","first":"Jack"},"address":{"\_id":"abcd","line1":"444  
Joe Empire","line2":"Suite 100"}}}  
} ]  
}  
}

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/39498c84-5727-4719-9a69-909b19b8eac2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/39498c84-5727-4719-9a69-909b19b8eac2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:32am UTC](https://discuss.elastic.co/t/query-string-query-problem-with-multi-fields/17325/2 "2017-07-06T01:32:00Z")

</div>


