Elasticsearch Non Analyzed Fields Regex aggregation

Hi Everyone

I am implementing one feature which includes city names (Example: "New York", "San Francisco"). I need to find document count at run time when user is typing the word. More like auto complete with counts.

Scenario:
Input: "Ne"
Output: "New York - 100 documents"

For this usecase in mind:
I created two fields namely cities(type: string, standard analyzer) and cities_non_analyzed (type: string, non analyzed).

But I am not able to apply it on non analyzed cities field using include in aggregations to get counts for the words that are matched in analyzed field.

Any pointer will be of good help

Thanks
Sri Harsha

Hi

I got a solution for this.

I am not able to delete this quesiton !! Can someone with appropriate rights delete the question.

Thanks
Sri Harsha

Why not share your solution so others can learn as well?

Hi Harsha,

I am also currently facing the same issue. It would be nice if you could share your solution.

Thanks,
Sekhar