我想在不删除索引的情况下对索引执行put a new mapping操作。Elasticsearch::Model似乎没有为此提供API。还是我怀念它?
发布于 2015-01-20 00:09:43
您可以在不删除任何数据或删除索引的情况下将新映射放在旧映射上。问题是更新的字段映射只应用于新数据,而不是现有数据。如果您希望将新映射应用于旧数据,则需要重新建立索引。
发布于 2018-04-18 23:13:40
给定Elasticsearch客户端,您可以像这样更新现有的字段映射:
client.indices.put_mapping index: 'myindex', type: 'mytype', body: {
mytype: {
properties: {
title: { type: 'string', analyzer: 'snowball' }
}
}
}发布于 2020-06-15 14:34:29
1登录到elastic search client
require 'elasticsearch'
client = Elasticsearch::Client.new log: true2使用映射数据创建新索引
client.indices.create index: 'testindex', body: {
"mappings": {
"dynamic": false,
"properties": {
title: { type: 'text' }
}
}
}3检查了新创建的索引
client.indices.get_mapping index: "testindex"https://stackoverflow.com/questions/28027070
复制相似问题