Parent child Query and highlighted result

I am new to search engine. I have started reading elasticsearch for almost
a month but I have not seen any example similar to the problem I am trying
to solve. Imagine I have in my mysql database a Case entity that has one
Employer entity , one Worker entity and many document entity

Case belongs to Worker
Case belongs to Employer
Case has_many Document

Worker has_many Cases

Employer has_many Cases

Document belongs_to Case

My entity is belows

  • Case ( number, year, description, employer_id, worker_id, documents)
  • Worker ( name, position, biography, email, phone)
  • Employer (name, country, note, email, phone)
  • document ( name, format, full_path)

For documents entity I use attachment type plugin to index it.

The cases is the most important part of my search . I want to search for
Cases with any field value in Case, Worker, Employer and Document and
result should be highlighted accordingly. For example

worker1 ( 'vicheka', 'Garment', 'Some biography', '',
'855975553553' )
worker2 ( 'tola', 'Garment', 'Some biography', '',
'855128374950' )
employer1 ( 'NGT group', 'Cambodia', 'some note', '',
'855975512445' )

case1( "001" , 2010, "Some description",,
case2( "002" , 2010, "Some description",,

document1 ('evident1.pdf', 'pdf', )
document2 ('evident2.docx', 'docx', )

document3 ('evident1.pdf', 'pdf', )
document4 ('evident2.docx', 'docx', )

When I type "" the case1 should return :

Case : 001-2010 vicheka vs NGT group
From Employer :
Employer NGT group Cambodia 855975512445

Case : 002-2010 tola vs NGT group
From Employer :
Employer NGT group Cambodia 855975512445

I am not sure the best way to go with mapping to solve this problem.

Sorry for my bad english. Please feel free to clarify.

I highly appreciate for any help.

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
For more options, visit