Hello,
i use an analyzer with the edgengram tokenizer.
The problem is, when i remove the first letter from a searchquery, the result is empty.
Its clear that the edgengram creates only terms from the beginning of a phrase. So i think thats why it happens.
Using the ngram instead is no option i think, because the results are not exact enough.
(i tried it)
As suggested
https://discuss.elastic.co/t/alternative-to-ngram-tokenizer-and-token-filter-substring-issue/53354
I can try reverse edgengram.
I tried it but it looks like it will only search reverse then!?
How can i search both. non reverse and reverse?
Is this possible? Are there better solutions?
PUT edge-ngram-123
{
"settings": {
"analysis": {
"analyzer": {
"autocomplete_index": {
"type": "custom",
"tokenizer": "autocomplete_token",
"filter": [
"lowercase"
]
},
"autocomplete_search": {
"tokenizer": "lowercase"
}
},
"tokenizer": {
"autocomplete_token": {
"type": "edge_ngram",
"min_gram": 3,
"max_gram": 10,
"token_chars": [
"letter",
"digit"
]
}
}
}
},
"mappings": {
"product_suggester": {
"properties": {
"searchField": {
"type": "text",
"analyzer": "autocomplete_index",
"search_analyzer": "autocomplete_search"
},
"ranking": {
"type": "long"
},
"primaryId": {
"type": "long"
}
}
}
}
}