search - How to index data using edge ngram in elasticsearch which include spaces also? -


i using edge ngram analyzer. while checking analyze api field getting below result.

for example query "galaxy j7", analyzed as.

["g","ga","gal","gala","galax","galaxy","j","j7"] 

i want data analyzed below.

["g","ga","gal","gala","galax","galaxy","galaxy j","galaxy j7"] 

how can possible?

the setting in index follows .

{   "analysis": {     "filter": {         "autocomplete_filter": {             "type": "edge_ngram",             "min_gram": "1",             "max_gram": "20"         }     },     "analyzer": {         "autocomplete_analyzer": {             "filter": ["lowercase", "autocomplete_filter"],             "type": "custom",             "tokenizer": "standard"         }     }   } } 

and mapping of field below.

{     "title_suggest": {         "type": "string",         "index_analyzer": "autocomplete_analyzer",         "search_analyzer": "standard",         "search_quote_analyzer": "autocomplete_analyzer"     } } 

you need use edgengram tokenizer, instead of edge_ngram filter:

{   "analysis": {     "tokenizer": {         "autocomplete_tokenizer": {             "type": "edgengram",             "min_gram": "1",             "max_gram": "20"         }     },     "analyzer": {         "autocomplete_analyzer": {             "filter": ["lowercase"],             "type": "custom",             "tokenizer": "autocomplete_tokenizer"         }     }   } } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -