What's the difference between fielddata_fields and docvalue_fields in inner hits?

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

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:

"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

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