我对如何在映射或数据类型改变后,在弹性搜索中重新索引数据感到有点困难。
根据弹性搜索文档
从你的旧索引中提取文件,使用滚动搜索,并使用批量API将它们索引到新的索引中。许多客户端的API提供了一个reindex()方法,它将为你完成所有这些工作。一旦你完成了,你可以删除旧的索引。
这是我的旧地图
"test-index2": { "mappings": { "business": { "properties": { "address": { "type": "nested", "properties": { "country": { "type": "string" "full_address": { "type": "string"
New Index mapping, I'm changing
full_address
->
location_address
我正在使用elasticsearch的python客户端
https://elasticsearch-py.readthedocs.org/en/master/helpers.html#elasticsearch.helpers.reindex
from elasticsearch import Elasticsearch
from elasticsearch.helpers import reindex
es = Elasticsearch(["es.node1"])
reindex(es, "source_index", "target_index")
然而,这将数据从一个索引转移到另一个索引。
我如何使用它来改变上述案例中的映射/(数据类型等)?