【问题标题】:Create new Index Mapping error创建新的索引映射错误
【发布时间】:2018-11-08 10:02:43
【问题描述】:

当我使用这样的映射创建索引时,_template/ 这个词是什么意思? _ 是什么意思?我请求您帮助了解有关创建索引的更多信息,它们是否存储在某种文件夹中,例如 template/packets 文件夹?

PUT _template/packets
{
  "template": "packets-*",
  "mappings": {
    "pcap_file": {
      "dynamic": "false",
      "properties": {
        "timestamp": {
          "type": "date"
        },
        "layers": {
          "properties": {
            "frame": {
              "properties": {
                "frame_frame_len": {
                  "type": "long"
                },
                "frame_frame_protocols": {
                  "type": "keyword"
                }
              }
            },
            "ip": {
              "properties": {
                "ip_ip_src": {
                  "type": "ip"
                },
                "ip_ip_dst": {
                  "type": "ip"
                }
              }
            },
            "udp": {
              "properties": {
                "udp_udp_srcport": {
                  "type": "integer"
                },
                "udp_udp_dstport": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  }
}

我问这个是因为在输入这个之后,我收到他的以下错误

!弃用:使用了弃用的字段 [模板],替换为 [index_patterns]

{ “承认”:真实 }

我从这个链接复制了模式: https://www.elastic.co/blog/analyzing-network-packets-with-wireshark-elasticsearch-and-kibana 而且我正在尝试完全按照链接中的内容进行操作,并且我已经可以使用 tshark 捕获文件并将它们解析复制到 packet.json 文件中,并且我将使用 filebeat 将数据传输到 Elasticsearch,我已经上传了一些数据到 Elasticsearch,但它没有被正确索引,我只是看到了很多带有大量数据的信息。

我的目标是准确了解如何创建新的索引模式,以及如何将我上传的内容与该索引相关联。 非常感谢。

【问题讨论】:

    标签: elasticsearch indexing kibana


    【解决方案1】:

    只需将单词template 替换为index_patterns

    PUT _template/packets
    {
      "index_patterns": ["packets-*"],
      "mappings": {
           ...
    

    索引模板允许您定义将在创建新索引时自动应用的模板。

    在 5.6 版本之后,Elasticsearch 索引模板的格式发生了变化; template 字段,用于指定一个或多个模式来匹配索引名称,在创建时将使用该模板,它已被弃用并被更恰当命名的字段 index_patterns 取代,其工作方式完全相同。

    要解决此问题并消除弃用警告,您必须更新所有 6.0 之前的索引模板,将 template 更改为 index_patterns

    您可以通过运行以下命令列出所有索引模板:

    curl -XGET 'http://localhost:9200/_template/*?pretty'
    

    或者将星号替换为特定索引模板的名称。

    更多关于 ES 模板的信息是here

    【讨论】:

    • 谢谢丹尼斯·拉苏列夫。我能问你点别的吗?我有 filebeat,我在 filebeat.yml 文件中输入了以下配置: setup.template.name: "packets-" setup.template.pattern: "packets-" output.elasticsearch: index: “packets-*”我不太了解如何使用 filebeat 发送我的文件并将它们与 _template/packets 索引匹配,你能帮我吗请 Denis :) 并提前感谢你的回答和帮助跨度>
    • 在这个链接中我问了另一个相关问题,为了继续按照步骤发送用 tshark 捕获的数据,通过 filebeat 到 Elasticsearch,请回答这个问题stackoverflow.com/questions/50591051/…
    • @ManuelArmandoFloresYáñez,感谢您接受答案。稍后我会检查您的其他问题。
    猜你喜欢
    • 2020-09-23
    • 2018-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多