I have a field called that is inside a nested field "name" that is a "Keyword" in elastic search.
Name field contains 2 values.
- Jagannathan Rajagopalan
- Rajagopalan.
If I query "Rajagopalan", I should get only the item #2. If I query the complete Jagannathan Rajagopalan, I should get #1.
How do I achieve it?
You need to use the term query which is used for exact search. Added a working example according to your use-case.
Index mapping
Index sample docs
And another doc
And search query
Search result