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/7a92ccfd-3df4-47a4-93bf-dd08a7eb8fb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to