# Elastic Search text similarity search

**URL:** https://discuss.elastic.co/t/elastic-search-text-similarity-search/305643
**Category:** Elasticsearch
**Created:** [May 25, 2022, 10:20pm UTC](https://discuss.elastic.co/t/elastic-search-text-similarity-search/305643 "2022-05-25T22:20:33Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [May 25, 2022, 10:59pm UTC](https://discuss.elastic.co/t/elastic-search-text-similarity-search/305643/2 "2022-05-25T22:59:24Z")

</div>

Hi @gkumargaur !

I found two options:

1 - In this [post](https://discuss.elastic.co/t/apply-fuzzy-search-and-searching-with-without-spaces/242964/3) the user created an analyzer to index the words without the white space.

2 - You can use a suggester to suggest the closest term to the user, it would be a "did you mean".

Ex:

```auto
PUT idx_did_you_mean
{
  "settings": {
    "analysis": {
      "filter": {
        "shingle_filter": {
          "max_shingle_size": "3",
          "min_shingle_size": "2",
          "type": "shingle"
        }
      },
      "analyzer": {
        "shingle_analyzer": {
          "filter": [
            "lowercase",
            "shingle_filter"
          ],
          "type": "custom",
          "tokenizer": "standard"
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "title": {
        "type": "text",
        "fields": {
          "suggest": {
            "type": "text",
            "analyzer": "shingle_analyzer"
          }
        }
      }
    }
  }
}

POST idx_did_you_mean/_doc
{
  "title":"San Jose"
}

GET idx_did_you_mean/_search
{
  "suggest": {
    "text": "sanjose city",
    "did_you_mean": {
      "phrase": {
        "field": "title.suggest",
        "size": 5
      }
    }
  }
}

```

---

_[View the full topic](https://discuss.elastic.co/t/elastic-search-text-similarity-search/305643)._
