I am developing an autocomplete feature in which i intend to show query suggestions something like this:
students who live in {City_name} [ City_name could contain values from list of cities ]
example_type 1 :
students who live in New...
[ following query suggestions should pop-up ] :
students who live in New york
students who live in New Jersey
(Looking up different entities [here cities, sports (eg: "students who play basketball" etc...]. )
example_type 2:
students who live in New york and play ba...
[ following query suggestions should pop-up ] :
students who live in New York and play basketball
students who live in New York and play baseball
etc..
I have tried building basic autocomplete on entities index using ElasticSearch, which is gisted here. (In my case, the child/entities index is dumped using a river-plugin.) I have naively checked on Nested Types and Parent / Child relationship but was not able to exactly figure out whether its the right fit for my requirement.
I am not sure on how to index these (parent) phrases alongwith child index to enable autocomplete search and generate possible suggest trees by querying/searching a single index.
It would be great if i can get some help to solve this kind of problem. Thanks in advance!