0

我有一个弹性搜索对象,其中一个字段是数组类型。现在我想应用与标准默认分析器不同的分析器。当我在索引定义中传递分析器时,它会抛出错误。我怎样才能做到这一点?

在下面的示例中,技能包含一个值数组。我想要的只是应用不同的分析器并查看结果。我怎样才能做到这一点?

      "skills": {
        "type": "object",
        "analyzer": "simple"
      },
      "profile": {
        "type": "text",
        "analyzer": "simple"
      },
      "job_title": {
        "type": "text",
        "analyzer": "simple"
      },

出现以下错误:

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Mapping definition for [skills] has unsupported parameters:  [analyzer : simple]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping [_doc]: Mapping definition for [skills] has unsupported parameters:  [analyzer : simple]",
    "caused_by": {
      "type": "mapper_parsing_exception",
      "reason": "Mapping definition for [skills] has unsupported parameters:  [analyzer : simple]"
    }
  },
  "status": 400
}
4

1 回答 1

0

ES 中没有专用 array的数据类型。如果skills是关键字数组,则可以使用type:text& analyzer:simple

提示:如果您想快速迭代不同分析器的效果,您可以使用_analyze端点,而不必每次都删除/调整/重新索引:

GET _analyze
{
  "text": [
    "lorem",
    "ipsum",
    "123abc"
  ],
  "analyzer": "simple"
}
于 2020-07-28T14:45:09.710 回答