Elasticsearch-删除索引并重新创建索引 [英] Elasticsearch - Delete index and re-create index
问题描述
如果我删除具有大数据的索引并在执行创建索引后立即创建索引(相同的索引名称)会发生什么情况?插入文件?
What Happen if I delete a index that has big data and right after executed create index (same index name) & insert document?
弹性搜索将保证有序进行吗?或有某种方式可以通过大规模传播?
Elastic search will guarantee to proceed orderly? or somehow there is passible to mass it up?
推荐答案
这将按预期工作.我假设您担心数据的删除将花费很长时间,并且您可能在Elasticsearch完成删除旧索引之前重新创建相同的索引名称?
This will work as expected. I assume you are concerned that the deletion of the data will take a long time and you might recreate the same index name before Elasticsearch finished removing the old one?
实际上,文件系统上没有使用索引名,而是为每个索引分配了一个UUID,用于存储(至少在5.x中).请参阅以下有关5.5.0的示例:
Actually, index names are not used on the filesystem and every index gets assigned a UUID instead, which is used for storage (at least in 5.x). See the following example on 5.5.0:
$ curl -XPUT -u "elastic:changeme" localhost:9200/test
{"acknowledged":true,"shards_acknowledged":true}
$ curl -XGET -u "elastic:changeme" localhost:9200/_cat/indices/test?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open test lwk6SME0SGaits-l2Y-DJg 5 1 0 0 810b 810b
$ ls /var/lib/elasticsearch/nodes/0/indices/lwk6SME0SGaits-l2Y-DJg/
0/ 1/ 2/ 3/ 4/ _state/
$ curl -XDELETE -u "elastic:changeme" localhost:9200/test
{"acknowledged":true}
$ curl -XPUT -u "elastic:changeme" localhost:9200/test
{"acknowledged":true,"shards_acknowledged":true}
$ curl -XGET -u "elastic:changeme" localhost:9200/_cat/indices/test?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open test cCJAB5i-Qjes7OUUo1m63w 5 1 0 0 810b 810b
$ ls /var/lib/elasticsearch/nodes/0/indices/cCJAB5i-Qjes7OUUo1m63w/
0 1 2 3 4 _state
$ ls /var/lib/elasticsearch/nodes/0/indices/lwk6SME0SGaits-l2Y-DJg/
ls: cannot access '/var/lib/elasticsearch/nodes/0/indices/lwk6SME0SGaits-l2Y-DJg/': No such file or directory
这篇关于Elasticsearch-删除索引并重新创建索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!