As a simplified example, I have "book" documents stored in elastic search so that a request GET /myindex/book/1 returns something like
{
"id": 1,
"title": "Hamlet",
"author": "William Shakespeare",
"pages": [
{"page_id": 1, "contents": "hello, world . . . this story is very well written"},
{"page_id": 5, "contents": "goodbye, world . . . i am done writing this book"}
]
}
What I'd like to do is run some sort of query that will get me records with individual matching pages. That is something like GET /myindex/book/_mySpecialQuery?q=hello would have results [{"page_id": 1, "contents": "hello, world . . . this story is very well written", "_parent": 1}] and GET /myindex/book/_mySpecialQuery?q=world would have results [{"page_id": 1, "contents": "hello, world . . . this story is very well written", "_parent": 1}, {"page_id": 5, "contents": "goodbye, world . . . i am done writing this book", "_parent": 1}] where _parent is the book's ID.
I cannot easily denormalize the data since it is coming from Mongo (via mongo-connector).
(This seems like it should be simple but I haven't seen any good ways to do this -- please do comment with a link if I'm just looking at the wrong terminology etc.)