# Scoring with query string query on multiple inner object fields

**URL:** <https://discuss.elastic.co/t/scoring-with-query-string-query-on-multiple-inner-object-fields/92165>\
**Category:** Elasticsearch\
**Created:** [July 6, 2017, 8:10pm UTC](https://discuss.elastic.co/t/scoring-with-query-string-query-on-multiple-inner-object-fields/92165 "2017-07-06T20:10:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marten](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@Marten](https://discuss.elastic.co/u/Marten)\
**Post date:** [July 6, 2017, 8:10pm UTC](https://discuss.elastic.co/t/scoring-with-query-string-query-on-multiple-inner-object-fields/92165/1 "2017-07-06T20:10:49Z")

</div>

Hi,

I'm trying to understand why my query ranking doesn't work the way I expect it.

My query is something like this:

"query\_string": {  
"query": "developer",  
"fields": [  
"preferredJobs.raw",  
"experiences.jobTitle",  
"experiences.companyName",  
"experiences.description",  
]  
}

I would expect that for each field the score would be calculated (so 4 scores) and that these scores would be **summed** to calculate the total score of the document (I use no boosting or whatsoever).  
Instead, the total score of the document is the score of the field with the **highest score**.  
I tried the same with a multi match query with the most\_fields type, but this still doesn't give the correct results.

What am I doing wrong?

Thanks,

Marten

---

<div class="post-metadata">

**Author:** ![Marten](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@Marten](https://discuss.elastic.co/u/Marten)\
**Post date:** [July 10, 2017, 3:44pm UTC](https://discuss.elastic.co/t/scoring-with-query-string-query-on-multiple-inner-object-fields/92165/2 "2017-07-10T15:44:17Z")

</div>

Although I still don't understand why it didn't work, I've solved it.  
I changed the single must query in multiple should queries and that worked.

Maren

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 11, 2017, 9:36am UTC](https://discuss.elastic.co/t/scoring-with-query-string-query-on-multiple-inner-object-fields/92165/3 "2017-07-11T09:36:32Z")

</div>

If you dont understand the ranking a good candidate to debug is the [explain API](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/search-explain.html) as well as setting `explain: true` in a search request (note both require additional resources, so only do those manually).

---

<div class="post-metadata">

**Author:** ![Marten](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@Marten](https://discuss.elastic.co/u/Marten)\
**Post date:** [July 12, 2017, 6:01am UTC](https://discuss.elastic.co/t/scoring-with-query-string-query-on-multiple-inner-object-fields/92165/4 "2017-07-12T06:01:58Z")

</div>

Hi Alexander,

Thanks for your response.  
I tried that already, that's why I found out that the query used the best score instead of summing them all up.  
Anyway, I've got it covered now.

Thanks,

Marten

---

<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:** [August 9, 2017, 6:02am UTC](https://discuss.elastic.co/t/scoring-with-query-string-query-on-multiple-inner-object-fields/92165/5 "2017-08-09T06:02:11Z")

</div>

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