1

I've an index on an Elasticsearch cluster, and I want to support phonetic matching.

This is my request:

curl -XPUT "http://localhost:9200/propertywebsites/_mapping/doc?pretty" -i -d '
{
"properties" : {
"phoneticbuilding" : {
"type" : "string",
"fields" : {
"phonetic" : {
"type" : "string",
"analyzer" : "dbl_metaphone"
}}}}
}
'

I received this error response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=UTF-8
Content-Length: 116

{
  "error" : "MapperParsingException[Analyzer [dbl_metaphone] not found for field [phonetic]]",
  "status" : 400
}

Anyone has any idea about why the dbl_metaphone analyzer couldn't be recognized for phonetic fields?

My elasticsearch's version is elasticsearch-1.7.2

Update 1

I already have the analyzer as the following

PUT myIndexName/
{
  "settings": {
    "analysis": {
      "filter": {
        "dbl_metaphone": {
          "type": "phonetic",
          "encoder": "double_metaphone"
        }
      },
      "analyzer": {
        "dbl_metaphone": {
          "tokenizer": "standard",
          "filter": "dbl_metaphone"
        }
      }
    }
  }
}

Update 2

Querying this request

curl -XGET "http://localhost:9200/propertywebsites/_settings?pretty"

I get the following response:

{
  "propertywebsites" : {
    "settings" : {
      "index" : {
        "creation_date" : "1451838136296",
        "number_of_shards" : "5",
        "number_of_replicas" : "1",
        "version" : {
          "created" : "1070299"
        },
        "uuid" : "KVOuKVgGRBudsSplownrgg",
        "analsis" : {
          "filter" : {
            "dbl_metaphone" : {
              "type" : "phonetic",
              "encoder" : "double_metaphone"
            }
          },
          "analyzer" : {
            "dbl_metaphone" : {
              "filter" : "dbl_metaphone",
              "tokenizer" : "standard"
            }
          }
        }
      }
    }
  }
}
4

1 回答 1

1

"dbl_metaphone" is a token filter and not an analyzer. You need to first install the Phonetic Analysis plug-in and then create a custom analyzer with it. Find more information at https://www.elastic.co/guide/en/elasticsearch/guide/current/phonetic-matching.html.

于 2016-01-03T17:49:42.657 回答