Suppose I have three documents in my elasticsearch. For Ex:
1: {
"name": "test_2602"
}
2: {
"name": "test-2602"
}
3: {
"name": "test 2602"
}
Now when I search it using fuzzy match query as given below
{
"query": {
"bool": {
"must": [
{
"bool": {
"must": [
{
"match": {
"name": {
"query": "test-2602",
"fuzziness": "2",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": true,
"lenient": false,
"zero_terms_query": "NONE",
"boost": 1
}
}
}
],
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1
}
}
],
"disable_coord": false,
"adjust_pure_negative": true,
"boost": 1
}
}
}
In response I am only getting two documents which is (even if I search by name value as => "test", "test 2602" or "test-2602")
{
"name": "test-2602"
},
{
"name": "test 2602"
}
I am not getting document with name as "test_2602" (not matching with value which contains underscore). I want it to include third document as well with name value as "test_2602". But If I search for name as "test_2602" then in response I get
{
"name": "test_2602"
}
I need to fetch all three documents whenever I search name as "test", "test 2602", "test-2602" and "test_2602"