q=_text_:cheese OR {!parent which="!_nest_path:*" v="+_nest_path:*
+_text_:cheese"}
fq=!_nest_path:*

So, query for documents matching :cheese or parents of documents which match
cheese, and filter out child documents.

(Not completely certain about these nest paths, particularly in the block
mask - I personally set an extra field to distinguish child from parent
documents, to make them easier to reason about.)

~ Sander

Dmitri Maziuk wrote:
> Hi all,
> 
> I'm having hard time wrapping my head around Mike's answer from 9 years 
> ago that is the only thing my google-fu turned up.
> 
> I have nested documents like
> 
> doc1
> id: doc1
> _text_ : cheese
> 
> doc2
> id: doc2
> _text_ : foo
> child:
>   id: doc2!child1
>   _nest_path_ : /doc1#0
>   _nest_parent: doc1
>   _text_: cheese
> 
> and I want to query for `q=_text_:cheese` and get back doc1 and doc2 but 
> not doc2!child1. My understanding is that I need to OR the {!parent} 
> query with the not-child query, but I'm getting lost in the exact syntax 
> of +'es and -'es.
> 
> Does anyone have it near the top of their head, by any chance?
> 
> TIA,
> Dima
> 

Reply via email to