如何使用 API 和索引名称创建索引模式

How to create Index pattern using API and Index Name

我通过 Elasticsearch API 创建了索引,为了创建可视化,我需要该特定索引的索引模式 ID。是否有可能使用 API

创建索引模式

是的,您可以通过 Saved Object API.

创建索引模式
$ curl -X POST <kibana-host>:<port>/api/saved_objects/index-pattern/index-pattern-id  -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '
{
  "attributes": {
    "title": "my-index-*"
  }
}'