Hi Everyone,
I am trying to search for data in my index with the exact match in prefix query, but the analyzer changes it to different tokens and give me results based on different tokens. For example I have few fields where I want to search data like "Test Da" with prefix query.
{
"script_fields": {},
"highlight": {
"fields": {
"": {}
},
"pre_tags": [
""
],
"post_tags": [
""
]
},
"_source": "",
"sort": [
"_score"
],
"query": {
"bool": {
"must_not": {
"query_string": {
"query": "DUMMY",
"fields": [
"F_DESC.bigram",
"OBJECTNUMBER"
]
}
},
"must": [
{
"bool": {
"should": [
{
"query_string": {
"fields": [
"F_DESC.bigram",
"OBJECTNUMBER"
],
"query": "TestDa*"
}
},
{
"multi_match": {
"fields": [
"F_DESC.bigram",
"OBJECTNUMBER"
],
"fuzziness": "AUTO",
"query": "Test Da"
}
},
{
"prefix": {
"F_DESC": {
"boost": 2,
"value": "Test Da"
}
}
}
]
}
}
]
}
}
}
but my result is something like data having "Test" on the top in a score. How can I find the most relevant data with "Test Da" at top (like an exact match).
Please help me with this. Any suggestion on this that we can achieve this in elastic query.