# I want the full match text comes first than their prefixes than their substrings results

**URL:** <https://discuss.elastic.co/t/i-want-the-full-match-text-comes-first-than-their-prefixes-than-their-substrings-results/311512>\
**Category:** Elasticsearch\
**Created:** [August 5, 2022, 11:27am UTC](https://discuss.elastic.co/t/i-want-the-full-match-text-comes-first-than-their-prefixes-than-their-substrings-results/311512 "2022-08-05T11:27:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rakhshunda\_Noorein\_J](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakhshunda_noorein_j/32/99407_2.png) [@Rakhshunda\_Noorein\_J](https://discuss.elastic.co/u/Rakhshunda_Noorein_J)\
**Post date:** [August 5, 2022, 11:27am UTC](https://discuss.elastic.co/t/i-want-the-full-match-text-comes-first-than-their-prefixes-than-their-substrings-results/311512/1 "2022-08-05T11:27:50Z")

</div>

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 :

```auto
{
  "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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 2, 2022, 11:28am UTC](https://discuss.elastic.co/t/i-want-the-full-match-text-comes-first-than-their-prefixes-than-their-substrings-results/311512/2 "2022-09-02T11:28:21Z")

</div>

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