# Semantic search - how to get correct results

**URL:** <https://discuss.elastic.co/t/semantic-search-how-to-get-correct-results/354269>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [February 27, 2024, 8:13pm UTC](https://discuss.elastic.co/t/semantic-search-how-to-get-correct-results/354269 "2024-02-27T20:13:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neroo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/neroo/32/132127_2.png) [@neroo](https://discuss.elastic.co/u/neroo)\
**Post date:** [February 27, 2024, 8:13pm UTC](https://discuss.elastic.co/t/semantic-search-how-to-get-correct-results/354269/1 "2024-02-27T20:13:08Z")

</div>

Hi! I am using the michelin dataset from [Getting Started with Elasticsearch | Elastic Videos](https://www.elastic.co/virtual-events/getting-started-elasticsearch) and using semantic search following [Semantic search | Elasticsearch Guide [8.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/semantic-search.html).

For the `cuisine` field, I created a `cuisine_embedding` using ELSER. However, when I try a query like

```auto
GET michelin2/_search
{
   "query":{
      "text_expansion":{
         "cuisine_embedding":{
            "model_id":".elser_model_2_linux-x86_64",
            "model_text":"not asian"
         }
      }
   }
}

```

instead of getting non-asian restaurants, I get only asian ones.

What would be a good way to fix it? I am new to NLP models.

---

<div class="post-metadata">

**Author:** ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)\
**Post date:** [February 28, 2024, 11:22am UTC](https://discuss.elastic.co/t/semantic-search-how-to-get-correct-results/354269/2 "2024-02-28T11:22:27Z")

</div>

Hey there, text expansion queries essentially take the semantic meaning of the words and join them together into a massive OR query. So that makes terms like “not \_\_\_” not really work the way you want it to. If you need to exclude results I’d probably suggest looking into creating Boolean queries and filtering out things you don’t want. However you’re not going to get that right out of the box with text expansion alone and depending on your use case you may need to do some front end work to formulate the query in the way you want.

---

<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 27, 2024, 11:23am UTC](https://discuss.elastic.co/t/semantic-search-how-to-get-correct-results/354269/3 "2024-03-27T11:23:12Z")

</div>

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