创建新的索引映射错误

Create new Index Mapping error

当我使用这样的映射创建索引时,_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"
                }
              }
            }
          }
        }
      }
    }
  }
}

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

!弃用:使用弃用的字段 [template],替换为 [index_patterns]

{ “承认”:真实 }

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

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

只需将单词 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