Elasticsearch query "Like" SQL

Hello everybody ,

i'm newbie in elastisearch ,
I want to make autocomplete feature on my site ,
How to make query like this on elasticsearch engine "SELECT * FROM Gadget where title like '%asus zenfone 2 ZE%'
I have tried several way to get the relevance result , but until this time i got result but not relevant data ,
when i search with keyword "red" i don't find "Xiaomi Redmi" on my search result , i must set "redmi" on my keyword

this is my analyze setting

"settings": {
"analysis": {
"filter": {
"nGram_filter": {
"type": "nGram",
"min_gram": 2,
"max_gram": 20,
"token_chars": [
"letter",
"digit",
"punctuation",
"symbol"
]
}
},
"analyzer": {
"nGram_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding",
"nGram_filter"
]
},
"whitespace_analyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
"lowercase",
"asciifolding"
]
}
}
}

So many thanks for your enlightenment friend :smile:

1 Like