I have a query where I search for a product name field. My products might contain punctuation and my queries might contain the punctuation as well. Given the following product title "CenterG 5.3 Drive Belt for model number 4421" and the query "Centerg 5.3 Drive Belt" I can obtain the results I would expect.
However, if the query contains no punctuation, the "CenterG 5.3 Drive Belt for model number 4421" product does not show up in the results. Instead other less relevant products that simply have "53" in the title render first.
I have tried both the english and standard analyzers but I believe I need to create my own analyzer and tokenizer but I am unsure what configuration settings I should use. The english analyzer works best so far with my data-set the only issue is the punctuation.
Here is my index:
{:properties=>{:name=>{:type=>"text", :analyzer=>"english"}}
And my query:
{
query: {
bool: {
should:
{
multi_match:{
fields: ["name"],
query: "#{query}"
}
}
}
}
}