# What's the difference between fielddata\_fields and docvalue\_fields in inner hits?

**URL:** https://discuss.elastic.co/t/whats-the-difference-between-fielddata-fields-and-docvalue-fields-in-inner-hits/123304
**Category:** Elasticsearch
**Created:** [March 9, 2018, 4:39pm UTC](https://discuss.elastic.co/t/whats-the-difference-between-fielddata-fields-and-docvalue-fields-in-inner-hits/123304 "2018-03-09T16:39:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![BLZB0B](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/blzb0b/32/24714_2.png) [@BLZB0B](https://discuss.elastic.co/u/BLZB0B)
#### Post date: [March 9, 2018, 4:39pm UTC](https://discuss.elastic.co/t/whats-the-difference-between-fielddata-fields-and-docvalue-fields-in-inner-hits/123304/1 "2018-03-09T16:39:58Z")

</div>

Hi,

we've noticed a perfomance hit on our inner hits, doing a bit of digging, we worked out that this was being caused by not setting \_source:false on _some_ of our inner hits.

the following document

[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html#nested-inner-hits-source](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-inner-hits.html#nested-inner-hits-source)

recommends settting source to false so that it doesn't need to traverse back and forth the parent document for each inner hit and to return the required values using docvalue\_fields.

on some of the other inner hits that have previously been "optimised", we're already using source: false but instead of docvalue\_fields, we're using fielddata\_fields thus:

```auto
"inner_hits":{
   "size":100,
   "_source": false,
   "fielddata_fields":[
                       "doc.fq.path.to.innerhit.field",
                       "doc.fq.path.to.innerhit.field.keyword"
                                   ]
   }

```

both _seem_ to perform similarly, both return the same results (albiet with a slighly different result "shape").

is there a preference of one over the other? I'm sure we're using fielddata\_fields after talking to @mvg months ago about nested nested inner hits.

the above tests were done using postman, but in "real" code, we use the NEST C# library to build the queries - not sure if there's a limit in there for one over the other..

Any guidance would be appreciated.

Regards

Phil

---

<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 6, 2018, 4:40pm UTC](https://discuss.elastic.co/t/whats-the-difference-between-fielddata-fields-and-docvalue-fields-in-inner-hits/123304/2 "2018-04-06T16:40:04Z")

</div>

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