Using snowball analyzer to handle plural/singular forms


(Eugene Prokopiev) #1

Hi,

Tried to use snowball analyzer to handle plural/singular forms while searching:

PUT locations
{
  "mappings": {
    "place": {
      "properties": {
        "name": { "type": "text", "analyzer": "snowball" }
      }
    }
  }
}

POST locations/place/1 
{ "name": "restaurant"}

GET locations/_search?q=restaurant
{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.2876821,
    "hits": [
      {
        "_index": "locations",
        "_type": "place",
        "_id": "1",
        "_score": 0.2876821,
        "_source": {
          "type": "restaurant"
        }
      }
    ]
  }
}

GET locations/_search?q=restaurants
{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 0,
    "max_score": null,
    "hits": []
  }
}

So it is not possible to find any by search phrase with 'restaurants'. Why and how to fix this?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.