I have a brand and a part number field which I have indexed using ElasticSearch 7.3.
In my mapping, I have assigned a standard analyzer to my brand field and a custom analyzer that maps .
to "" for my part_number
field.
I have records with a brand of "Proform" & "Healthrider" each have a part number field with the value 220769
. When I query "Proform 220769" I receive the correct results. However, when I query "Proform 22076.9" I only receive "Healthrider" results. I have increased the boost on my brand field and when I do so I only see other proform products but not the one I have stored in my index with the corresponding part number.
Here are my fields:
{:properties=>{:brand=>{:type=>"text", :analyzer=>"standard"}, :part_number=>{:type=>"text", :analyzer=>"no_dots"}}
And my mapping:
settings index: {
number_of_shards: 1
},
analysis: {
analyzer: {
no_dots: {
tokenizer: "standard",
char_filter: [
"replace_dots"
],
filter: ["lowercase"]
}
},
"char_filter": {
"replace_dots": {
"type": "mapping",
"mappings": [
". =>"
]
}
}
}
And my query:
{
query:{
multi_match:{
fields: ["part_number", "brand"],
query: "#{query}"
}
},highlight: {
fields: {
:"*" => {}
}
}
}