Elastic Search text similarity search

Hi @gkumargaur !

I found two options:

1 - In this post 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:

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
      }
    }
  }
}