ElasticSearch match score ElasticSearch match score elasticsearch elasticsearch

ElasticSearch match score


Starting from the same index settings (analyzers, filters, mappings) as in my previous reply, I suggest the following solution. But, as I mentioned, you need to lay down all the requirements in terms of what you need to search for in this index and consider all of this as a complete solution.

DELETE testPUT test{  "settings": {    "analysis": {      "analyzer": {        "custom_stop": {          "type": "custom",          "tokenizer": "standard",          "filter": [            "my_stop",            "my_snow",            "asciifolding"          ]        }      },      "filter": {        "my_stop": {          "type": "stop",          "stopwords": "_french_"        },        "my_snow": {          "type": "snowball",          "language": "French"        }      }    }  },  "mappings": {    "test": {      "properties": {        "keywordName": {          "type": "text",          "analyzer": "custom_stop",          "fields": {            "raw": {              "type": "keyword"            }          }        }      }    }  }}POST /test/test/_bulk{"index":{}}{"keywordName":"samsung galaxy"}{"index":{}}{"keywordName":"samsung charger"}{"index":{}}{"keywordName":"samsung cover"}{"index":{}}{"keywordName":"samsung"}GET /test/_search{  "query": {    "bool": {      "should": [        {          "match": {            "keywordName": {              "query": "samsungs",              "operator": "and"            }          }        },        {          "term": {            "keywordName.raw": {              "value": "samsungs"            }          }        },        {          "fuzzy": {            "keywordName.raw": {              "value": "samsungs",              "fuzziness": 1            }          }        }      ]    }  },  "size": 10}