Hello guys,
I've an issue with a match query on a text field that contains a product title.
Product titles:
- A:
Spezial-Träger
- B:
Träger
If someone searches for Spezial-Träger
only A should match since it's the most precise match you can get, because it's exactly the product the customer is searching for.
But if you enter Träger
it should match the base product Träger
as well as the more precise one Spezial-Träger
.
I tried to define an index_analyzer
which generates all possible token variations of the indexed product:
A: spezialtrager
, spezial
, trager
B: trager
Then I tried to define a search_analyzer
which only generates the most precise token possible:
A: spezialtrager
B: trager
ES _analyze:
Index: "Spezial-Träger":
{
"tokens": [
{
"token": "spezialtrager",
"start_offset": 0,
"end_offset": 14,
"type": "word",
"position": 0
},
{
"token": "spezial",
"start_offset": 0,
"end_offset": 7,
"type": "word",
"position": 0
},
{
"token": "trager",
"start_offset": 8,
"end_offset": 14,
"type": "word",
"position": 1
}
]
}
Search: "Spezial-Träger":
{
"tokens": [
{
"token": "spezialtrager",
"start_offset": 0,
"end_offset": 14,
"type": "word",
"position": 0
}
]
}
As I follow the ES documentation:
- Tokens are evaluated in an specific order, different analyzers have to generate the same order of common tokens
But I don't get any match. I am lost
Thanks a lot for any help.
Kind regards,
Christian