Mapping case-insensitive, prefix enabled analyzer

(vishalshukla) #1

I need to have a string field, which should be case-INsensitive & it should consider complete text as a "term". So if I have a field with value like "userName":"Vishal Shukla".

The document

  1. should be returned in search like this: "userName":"vishal shukla"
  2. should be returned in some sort of prefix search with "userName":"vish"
  3. should NOT return result if search term is "userName":"shu"

Tried with "not_analyzed" field, which makes it case-sensitive. "keyword_lowercase" custom analyzer would fail in case 3 above.

Please suggest how should I work around this problem.

Thanks & Regards,
Vishal Shukla

(system) #2