Elastic Serach query not matching encoded string(45" - 45")

We have product details which contain length parameter which has value as 45"(45 inch) So on indexing this product details I am converting 45" to encoded string ie 45&quot ;
So on search i will send the search parameter encoded ie if user search product on 45" i will send it as 45&quot. But elastic search doesn't give any result.
This filed in product details is mapped as -
product_length is array
"properties": {
"product_length": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
},
"fielddata": true
}
}
and to find products which have product length 45" i am using bellow query:

Search term is encoded before search ie 45" to 45&quot ;

{
"query": {
"bool": {
"must": [{
"terms": {
"product_length": ["45&quot ;"]
}
}]
}
}
}

result:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits":
}
}

But it return's: "hits":

Is there another way I should follow?

I tried with wildcard query but it's not working
{
"wildcard": {
"product_description": {
"value": "45&quot ;",
"boost": 1.5
}
}
}
Then i tried with "simple_query_string" , its Working on exact match but i couldn't able to get result for partial search term ie 45
{
"simple_query_string" : {
"fields" : ["product_name","tags"],
"query" : "45&quot ;"
}
}
then i tried with "match" query it solves the problem:
{
"match": {
"tags": "45&quot ;*"
}
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.