Opensearch Did-you-mean functionality- string_distance built-in support

Hi,
Does opensearch have built-in/native support for algorithms mentioned in string_distance part at

or is it the same case like mentioned in elastic discussions?

If there is a native support, where can we find documentation and example usage for this feature?

We would like to try jaro_winkler on opensearch
Thanks.

I think it’s both :slight_smile:

That is, I think it’s the same implementation, but Elasticsearch also supports jaro_winkler: Suggesters | Elasticsearch Guide [8.8] | Elastic

I could not able to find any example unfortunately :frowning:

I would like to search against my document’s field using jaro_winkler algorithm

this does not find anything for example

PUT books/_doc/1
{
  "title": "OpenSearch"
}
GET books/_search
{
  "suggest": {
    "spell-check": {
      "text": "Open",
      "term": {
        "field": "title",
        "string_distance":"jaro_winkler"
      }
    }
  }
}

I am wondering what I might be missing here :confused:

maybe it is because allowed max distance is 2 because the following query returns.

GET books/_search
{
  "suggest": {
    "spell-check": {
      "text": "Opensear",
      "term": {
        "field": "title",
        "string_distance":"internal"
      }
    }
  }
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "suggest" : {
    "spell-check" : [
      {
        "text" : "opensear",
        "offset" : 0,
        "length" : 8,
        "options" : [
          {
            "text" : "opensearch",
            "score" : 0.75,
            "freq" : 1
          }
        ]
      }
    ]
  }
}

Right, from my understanding the string distance algorithm is used to compute the distance, so the order of suggestions, but I don’t think you can search with a distance more than 2 characters.

1 Like