Elasticsearch索引分析器设置

时间:2017-06-01 21:25:04

标签: elasticsearch

我是弹性搜索的初学者。我试图在我的索引中添加一个分析器。这是编码:

PUT drug_mono6/_settings
{
"analysis": {
"analyzer": {
  "attachment.content": {
    "type": "custom",
    "tokenizer": "Whitespace"
  }
}
}
}

但是,在执行此操作后,我无法重新打开索引。我收到的错误是:

{
"error": {
"root_cause": [
{
"type": "exception",
"reason": "Failed to verify index [drug_mono6/SMmaJ4iPTCSUHp-oedsadA]"
}
],
"type": "exception",
"reason": "Failed to verify index [drug_mono6/SMmaJ4iPTCSUHp-oedsadA]",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "analyzer [attachment] must specify either an analyzer type, or 
 a tokenizer"
}
},
"status": 500
}`

有没有办法修改设置并删除更改?

1 个答案:

答案 0 :(得分:0)

这应该有效

PUT drug_mono6
{
    "analysis": {
        "analyzer": {
            "attachment": {
                "type": "custom",
                "tokenizer": "whitespace"
            }
        }
    }
}

https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-custom-analyzer.html