Elasticsearch not returning singular/plural matches

后端 未结 3 1078
名媛妹妹
名媛妹妹 2021-02-02 03:01

I am using a php library of elasticsearch to index and find documents in my website. This is the code for creating the index:

curl -XPUT \'http://localhost:9200/         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-02 03:21

    The default elascticsearch analyzer doesn't do stemming and this is what you need to handle plural/singular. You can try using Snowball Analyzer for your text fields to see if it works better for your use case:

    curl -XPUT 'http://localhost:9200/test' -d '{
        "settings" : {
            "index" : {
                "number_of_shards" : 1,
                "number_of_replicas" : 1
            }
        },
        "mappings" : {
            "page" : {
                "properties" : {
                    "mytextfield": { "type": "string",  "analyzer": "snowball", "store": "yes"}
                }
            }
        }
    }'
    

提交回复
热议问题