# Is there any way to score nested documents as if they're native fields of the main document?

**URL:** <https://discuss.elastic.co/t/is-there-any-way-to-score-nested-documents-as-if-theyre-native-fields-of-the-main-document/267934>\
**Category:** Elasticsearch\
**Created:** [March 22, 2021, 3:20am UTC](https://discuss.elastic.co/t/is-there-any-way-to-score-nested-documents-as-if-theyre-native-fields-of-the-main-document/267934 "2021-03-22T03:20:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaron\_Golan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yaron_golan/32/85877_2.png) [@Yaron\_Golan](https://discuss.elastic.co/u/Yaron_Golan)\
**Post date:** [March 22, 2021, 3:20am UTC](https://discuss.elastic.co/t/is-there-any-way-to-score-nested-documents-as-if-theyre-native-fields-of-the-main-document/267934/1 "2021-03-22T03:20:09Z")

</div>

Is it possible to get similar scoring methodologies for nested document fields normal fields?

See searches for "awful" (nested) and "amazing" (direct) below.

```auto
DELETE /testindex

PUT /testindex
{
  "mappings": {
    "properties": {
      "nestedSummaries": {
        "type": "nested" 
      }
    }
  }
}

PUT testindex/_doc/1
{
  "summaries" : [
    "This movie is amazing",
    "This movie is really amazing",
    "This movie is the most amazing thing that I've seen"  
  ],
  "nestedSummaries" : [
    {
      "text" : "This movie is awful"
    },
    {
      "text" : "This movie is really awful"
    },
    {
      "text" : "This movie is the most awful thing that I've seen"
    }
  ]
}

PUT testindex/_doc/2
{
  "summaries" : [
    "This movie is amazing",
    "This movie is really amazing",
    "This movie is the most amazing thing that I've seen"  
  ],
  "nestedSummaries" : [
    {
      "text" : "This movie is awful"
    },
    {
      "text" : "This movie is really awful"
    },
    {
      "text" : "This movie is the most awful thing that I've seen"
    }
  ]
}

GET testindex/_search?explain=true
{
  "query": {
    "simple_query_string": {
      "query": "amazing"
    }
  }  
}

GET testindex/_search?explain=true
{
  "query": {
     "nested": {
      "path": "nestedSummaries",
      
      "query": {
        "simple_query_string": {
          "query": "awful"
        }
      },
      "score_mode": "sum"
    }
  }  
}

```

---

<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:** [April 19, 2021, 3:20am UTC](https://discuss.elastic.co/t/is-there-any-way-to-score-nested-documents-as-if-theyre-native-fields-of-the-main-document/267934/2 "2021-04-19T03:20:22Z")

</div>

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