1

我有以下问题:我有 3000 万个文档的索引,映射如下:

curl -XPUT localhost:8080/xxxxx/yyyyy/_mapping?pretty=true -d '{"xxxxx":{"_id":{"type":"string","index":"not_analyzed"},"properties":{"content":
{"type":"string","store":"no"},"title":{"type":"string","index":"no"},"created_date":{"type":"integer","index":"not_analyzed"},"url":
{"type":"string","index":"not_analyzed"},"author":{"type":"string","index":"no"},"author_url":{"type":"string","index":"no"},"domain":
{"type":"string","index":"not_analyzed"},"lang":{"type":"string","index":"no"}}}}'

设置中没有选择 Tokenizer,所以应用一个标准。我想请求“方面”在“内容”字段中创建排名链接(网址)。不幸的是,我不能这样做,因为标准标记器共享链接(url)。问题:现有索引是否可以在不重新索引的情况下更改分词器,以便添加到索引中的新文档处理新的分词器(uax_url_email)而旧文档保持不变。

我试过了:

curl -XPUT localhost:8080/xxxxx -d '{
  "settings" : {
    "index": {
      "analysis" :{
        "analyzer": {
          "default": {
            "type" : "custom",
            "tokenizer" : "uax_url_email",
            "filter" : "lowercase"
          }
        }
      }
    }
  }
}
'

但我收到一个错误: {"error": "IndexAlreadyExistsException [[xxxxx] Already exists]", "status": 400}

是否有另一种方法不使用查询“方面”重新索引以创建排名链接(url)?

提前感谢您的任何帮助

4

1 回答 1

1

接下来尝试,对于现有索引“xxxxx”

curl -XPUT localhost:8080/xxxxx/_settings -d '{
      "analysis" :{
        "analyzer": {
          "default": {
            "type" : "custom",
            "tokenizer" : "uax_url_email",
            "filter" : "lowercase"
          }
        }
      }
}

确保您的 elasticseach 端口为 8080,默认为 9200

于 2014-01-24T13:46:26.970 回答