Hi András,

Thank you for you answer. I read the links you sent and I think the following sentence :

"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." (http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/)

particularly illustrates your answer.

Thanks,

Aurélien

On 21.10.2014 08:51, András Péteri wrote:
Hello Aurélien,

I believe the approach you described is what Elasticsearch is taking with nested documents, in addition to indexing parent and child documents in a
single block. See the "sidebar" at the bottom of [1] and the sections
labeled "nested" of [2] for more details.

Michael's blog post on BlockJoinQuery [3] is also relevant in this regard.

[1]
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-nested-type.html
[2]
http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/
[3]
http://blog.mikemccandless.com/2012/01/searching-relational-content-with.html

On Mon, Oct 20, 2014 at 9:43 PM, Aurélien MAZOYER <
aurelien.mazo...@francelabs.com> wrote:

Hi again,

Maybe the only way to do this is to use nested documents and to index data both in child documents and in flattened form in the parent document. Then
we can run the two different queries.

Any other (better) idea?

Regards,

Aurélien

Le 20/10/2014 13:40, aurelien.mazo...@francelabs.com a écrit :


Hi,

I have question regarding nested document queries:
For example, let’s say that I have the following book:
Book _title: Nested document for dummies
Chapter1_Title: Introduction
Chapter1_Content: Nested documents are fun.
Chapter2_Title: Which technology should I use?
Chapter2_Content: Lucene of course!

First I want to find books that contain an introduction and that are
about Lucene. So I decide to flatten my data and use 3 multivalued fields (Book_Title,Chapter_Title and Chapter_Content), I index my document and
then I get what I want when I use the following query : “
chapter_title:Introduction AND chapter_title:Lucene “
Now I want to find books that contain “fun” in a chapter called
“introduction”. My model is no more valid (Chapter2_content is no more linked with Chapter2_title). That is why I change my datamodel and use
nested documents:
I have now a parent with a single valued field Book_title and different childs with single valued fields Chapter_title and Chapter_Content. Now, when I run the query “chapter_title: Introduction AND chapter_content:fun” I also get what I want… But what do I have to do if I want to use these two
kinds of query with a unique data model?

Thank you,


Regards,

Aurélien MAZOYER

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to