elasticsearch Elasticsearch“;未能找到analyzer";,elasticsearch,mapping,analyzer,elasticsearch,Mapping,Analyzer" /> elasticsearch Elasticsearch“;未能找到analyzer";,elasticsearch,mapping,analyzer,elasticsearch,Mapping,Analyzer" />

elasticsearch Elasticsearch“;未能找到analyzer";

elasticsearch Elasticsearch“;未能找到analyzer";,elasticsearch,mapping,analyzer,elasticsearch,Mapping,Analyzer,我已在索引上创建了同义词分析器: curl http://localhost:9200/test_index/_settings?pretty { "test_index" : { "settings" : { "index" : { "creation_date" : "1429175067557", "analyzer" : { "search_synonyms" : { "filter" :

我已在索引上创建了同义词分析器:

curl http://localhost:9200/test_index/_settings?pretty
{
  "test_index" : {
    "settings" : {
      "index" : {
        "creation_date" : "1429175067557",
        "analyzer" : {
          "search_synonyms" : {
            "filter" : [ "lowercase", "search_synonym_filter" ],
            "tokenizer" : "standard"
          }
        },
        "uuid" : "Zq6Id8xsRWGofJrNCb7M8w",
        "number_of_replicas" : "1",
        "analysis" : {
          "filter" : {
            "search_synonym_filter" : {
              "type" : "synonym",
              "synonyms" : [ "sneakers,pumps" ]
            }
          }
        },
        "number_of_shards" : "5",
        "version" : {
          "created" : "1050099"
        }
      }
    }
  }
}
但当我尝试将其用于映射时:

curl -XPUT 'http://localhost:9200/test_index/_mapping/product_catalog?pretty' -H "Content-Type: application/json" \
   -d '{"product_catalog": {"properties" : {"name": {"type": "string", "include_in_all": true, "analyzer":"search_synonyms"} }}}'
我得到一个错误:

{
  "error" : "MapperParsingException[Analyzer [search_synonyms] not found for field [name]]",
  "status" : 400
}
我还尝试通过以下方式检查分析仪:

curl 'http://localhost:9200/test_index/_analyze?analyzer=search_synonyms&pretty=1&text=pumps'
但是仍然会得到一个错误:

ElasticsearchIllegalArgumentException[failed to find analyzer [search_synonyms]]

任何想法,我可能遗漏了什么,但我想不出是什么。

analyzer元素必须在您的分析组件中。按如下方式更改索引创建者:

{
    "settings": {
        "index": {
            "creation_date": "1429175067557",
            "uuid": "Zq6Id8xsRWGofJrNCb7M8w",
            "number_of_replicas": "0",
            "analysis": {
                "filter": {
                    "search_synonym_filter": {
                        "type": "synonym",
                        "synonyms": [
                            "sneakers,pumps"
                        ]
                    }
                },
                "analyzer": {
                    "search_synonyms": {
                        "filter": [
                            "lowercase",
                            "search_synonym_filter"
                        ],
                        "tokenizer": "standard"
                    }
                }
            },
            "number_of_shards": "5",
            "version": {
                "created": "1050099"
            }
        }
    }
}

谢谢,我真不敢相信我错过了。