You're great!

I have been trying for several hours... as far as I can tell right now, 
your solution is delivering correct results.

Thank you very much!


Am Montag, 13. Oktober 2014 12:24:42 UTC+2 schrieb Michael Werner:

> I am pretty new to ES and have a problem that I could not yet solve using 
> the docuemntation, so any help is appreciated...
>
> I have these douments in my index:
>
> DocType1
> {
>   "id" : 1,
>   "name" : "ABC",
>   "year" : 2014,
>   "page" : 123,
>   "linked_docs" : {
>     {
>       {
>         "id" : 2,
>         "name" : "DEF",
>         "year" : 2013,
>         "page" : 111
>       },
>       {
>         "id" : 3,
>         "name" : "GHI",
>         "year" : 2012,
>         "page" : 222
>       },
>     }
>   }
> },
> {
>   "id": 12345,
>   "name" : "XYZ",
>   "year" : 2014,
>   "page" : 999,
>   "linked_docs" : { }
> }
>
> DocType2
> {
>   "id" : 98765,
>   "user" : "User 1",
>   "type" : "Test",
>   "linked_docs" : {
>     {
>       {
>         "id" : 1,
>         "name" : "ABC",
>         "year" : 2014,
>         "page" : 123
>       },
>       {
>         "id" : 2,
>         "name" : "DEF",
>         "year" : 2013,
>         "page" : 111
>       },
>     }
>   }
> },
> {
>   "id" : 4321,
>   "user" : "User 2",
>   "type" : "Test 2",
>   "linked_docs" : { }
> }
>
>
> Now I want to get all documents matching name = ABC, year = 2014, page = 
> 123 either in the main document >>> OR <<< in the linked_docs.
>
> So with the data aboce the search should deliver the following documents:
>
> - DocType1, id: 1 (matches in main document)
> - DocType2, id: 98765 (matches in linked docs)
>
> I tried with nested query but I am not getting the result as above. 
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/9c99d4b9-b3f3-4242-85f6-d387a1f2a231%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to