Suppose If I am searching for Rohan Roy, I want Rohan Roy matching results comes first then rohan , rohan chohan etc....
The query I have used :
{
"size": 1000,
"query": {
"bool": {
"must": [
{
"terms": {
"EntityType": ["entity1","entity2"]
}
},
{
"multi_match": {
"query": "Rohan Roy",
"type": "most_fields",
"fields": [
"EntityType", "Title",
"Title._2gram","Title._3gram","Title._index_prefix",
"Description","Description._2gram","Description._3gram","Description._index_prefix",
"Name","Name._2gram","Name._3gram","Name._index_prefix"
"Tags","Tags._2gram","Tags._3gram","Tags._index_prefix",
],
"fuzziness": "AUTO"
}
}
]
}
}
}
I am searching on 2 indices.
Index1 document fields: EntityType, Title, Description
Index2 document fields: EntityType, Name, Tags
where EntityType is a keyword field and all are search-as-you-type fields.