elasticsearch - 如何在elasticsearch中批量创建(导出/导入)索引?

标签 elasticsearch logstash kibana

我正在尝试按照 re-index from remote 将我们的 ELK 堆栈从 1.x > 5.x 升级指示。我不确定如何导出需要创建的索引列表,然后将该列表导入到新实例中。我使用 this command 创建了一个索引列表,都带有“漂亮”和不带有“漂亮”,但我不确定要使用哪种文件格式以及下一步如何处理该文件。

创建索引指令不会涉及如何一次创建多个索引,批量指令仅涉及创建/索引文档,而不是创建索引本身。任何有关如何最好地遵循升级说明的帮助将不胜感激。

我显然没有足够的声誉来链接“创建索引”和“批量”指令,因此对此表示歉意。

最佳答案

使用单个curl命令,您可以创建index template这将在文档到达 ES 5.x 集群时触发索引创建。

基本上,这个单一的curl命令将创建一个索引模板,该模板将为动态创建的每个新索引启动。然后,您可以使用“远程重新索引”技术将文档从 ES 1.x 移动到 ES 5.x,并且不必担心索引创建,因为索引模板会处理它。

curl -XPUT 'localhost:9200/_template/my_template' -H 'Content-Type: application/json' -d'
{
  "template": "*",
  "settings": {
     "index.refresh_interval" : -1,
     "index.number_of_replicas" : 0
  }
}
'

关于elasticsearch - 如何在elasticsearch中批量创建(导出/导入)索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40682331/

相关文章:

json - 将JSON文件索引到elasticsearch命令/映射错误中

elasticsearch - 如何保护 Titan - Elasticsearch 与 ssl/tls 的连接?

c# - 弹性NEST返回不一致的结果

ssl - 无法将 Filebeat 连接到 Logstash

nginx - worker_connections 还不够

elasticsearch - 复杂 Elasticsearch 查询

Elasticsearch - 在同一嵌套范围内聚合多个字段

elasticsearch - 如何使用过滤器查询优化 Elasticsearch aggs

elasticsearch - 合并filebeat + logstash中的行

elasticsearch - 由于我的位置字段未设置为geo_point,因此无法正确输入提取的数据