You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chris Bell <ch...@gmail.com> on 2017/02/22 19:47:08 UTC

Nested Document (aka Block Join) Query with Multiple Criteria

I am trying to perform a Nested Document query containing multiple
criteria, which can be treated as an AND in regards to the parent document.

With the structure:

ParentDocument: {
    id:1
    ChildDocument: {
        id:1.1
        field1:value1,
        field2:value2
    },
    ChildDocument: {
        id:1.2
        field1:value3,
        field2:value4
    }
},
ParentDocument: {
    id:2
    ChildDocument: {
        id:2.1
        field1:value1,
        field2:value2
    },
    ChildDocument: {
        id:2.2
        field1:value5,
        field2:value6
    }
}

I want to have a criteria that would say:
"Give me the parents where any of the children fulfill these requirements:
field1:value1 and field2:value4"

Based on this criteria, I would expect ParentDocument with id:1 as the only
document that's returned, since ChildDocument 1.1 fulfills the criteria of
field1:value1 and ChildDocument 1.2 fulfills field2:value4

Is this even possible? And if so, how would I go about performing and
constructing the query?

I am running with Solr 6.1 in a single core mode at the moment, but I plan
to eventually move to a Solr Cloud

Chris Bell