# Nested queries and cross referencing

**URL:** <https://discuss.elastic.co/t/nested-queries-and-cross-referencing/17929>\
**Category:** Elasticsearch\
**Created:** [June 5, 2014, 4:19pm UTC](https://discuss.elastic.co/t/nested-queries-and-cross-referencing/17929 "2014-06-05T16:19:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Fox](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@David\_Fox](https://discuss.elastic.co/u/David_Fox)\
**Post date:** [June 5, 2014, 4:19pm UTC](https://discuss.elastic.co/t/nested-queries-and-cross-referencing/17929/1 "2014-06-05T16:19:44Z")

</div>

After reading this  
[http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/](http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/)  
excellent document on managing relations in Elasticsearch, I have decided  
that 'nested queries' are the best solution for our particular query  
needs.Of the list of negatives for nested queries documented in the link  
above, 1) using the special nested query 2) having to reindex the entire  
document after and update and 3) inability to cross reference between  
nested objects, it is this third item that I still find confusing. Would  
someone be able to provide a sample document, nested mapping, and query  
that will _not_ work due to this issue?

Here is the snippet from the source document for which I would like further  
clarification:

_"Lastly, it is not possible to “cross reference” between nested documents.  
One nested doc cannot “see” another nested doc’s properties. For example,  
you are not able to filter on “A.name” but facet on “B.age”. You can get  
around this by using `include_in_root`, which effectively copies the nested  
docs into the root, but this get’s you back to the problems of inner  
objects."_

--  
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/38251437-497d-4e73-81a2-714295a09091%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/38251437-497d-4e73-81a2-714295a09091%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:24am UTC](https://discuss.elastic.co/t/nested-queries-and-cross-referencing/17929/2 "2017-07-06T01:24:26Z")

</div>


