# Prioritize Exact/Like Matches

**URL:** <https://discuss.elastic.co/t/prioritize-exact-like-matches/73776>\
**Category:** Elasticsearch\
**Created:** [February 3, 2017, 12:05am UTC](https://discuss.elastic.co/t/prioritize-exact-like-matches/73776 "2017-02-03T00:05:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobBob](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@RobBob](https://discuss.elastic.co/u/RobBob)\
**Post date:** [February 3, 2017, 12:05am UTC](https://discuss.elastic.co/t/prioritize-exact-like-matches/73776/1 "2017-02-03T00:05:12Z")

</div>

Hello,

I have a list of a few thousand categories and I am having trouble prioritizing exact/like matches to the top. For example, I will search for "Movie Theater" and be returned a list of items from my index in this order:

Performing Arts Theater  
Dinner Theater  
Movie Studio  
...  
Movie Theater

How can I have the exact result returned first and why isn't it happening already?

```
curl -XPUT http://localhost:9200/categories -d '{
  "settings": {
    "analysis": {
      "filter": {
        "category_synonym_filter": {
          "type": "synonym",
          "synonyms": ["bike,bicycle", "bar,pub"]
        }
      },
      "analyzer": {
        "lower_synonyms": {
          "tokenizer": "standard",
          "filter": ["lowercase", "category_synonym_filter"]
        }
      }
    }
  }
}'

curl -XPUT http://localhost:9200/categories/category/_mapping -d '{
  "category" : {
    "properties" : {
      "category_description" : {
        "type" : "string",
        "analyzer": "lower_synonyms"
      },
      "type" : {
        "type" : "string",
        "index" : "not_analyzed"
      }
    }
  }
}'

{size=100, query={bool={filter={bool={must=[{query_string={query=movie theater* OR movie theater OR movie theater~1, fields=[category_description]}}]}}, must={match_all={}}}}, from=0}

```

Thank you in advance!

---

<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:** [March 3, 2017, 12:05am UTC](https://discuss.elastic.co/t/prioritize-exact-like-matches/73776/2 "2017-03-03T00:05:15Z")

</div>

Closed on March 3, 2017, 12:05am UTC

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