You have defined multi field mapping for the tags.title
field, but you are indexing and searching title
field. Try this test data:
curl -XPUT localhost:9200/testindex/document/1 -d '{"tags":{"title": "Fight for your life"}}'
curl -XPUT localhost:9200/testindex/document/2 -d '{"tags":{"title": "Fighting for your life"}}'
curl -XPUT localhost:9200/testindex/document/3 -d '{"tags":{"title": "Will you just start the fight"}}'
with the following searches:
curl -XGET 'localhost:9200/testindex/document/_search?q=title:life&pretty=1'
curl -XGET 'localhost:9200/testindex/document/_search?q=tags.title:life&pretty=1'
curl -XGET 'localhost:9200/testindex/document/_search?q=document.tags.title:life&pretty=1'
curl -XGET 'localhost:9200/testindex/document/_search?q=title2:life&pretty=1'
curl -XGET 'localhost:9200/testindex/document/_search?q=tags.title.title2:life&pretty=1'
curl -XGET 'localhost:9200/testindex/document/_search?q=document.tags.title.title2:life&pretty=1'