OpenSearch 1.2 - 以编程方式索引模式

Wol*_*tto 7 opensearch

我正在尝试以编程方式在 Opensearch 中创建index_pattern仪表板。

由于我在 Opensearch 文档中没有找到任何与之相关的内容,因此我尝试了elastic search saved_objectsapi:

POST /api/saved_objects/index-pattern/my_index_pattern
{
  "attributes":{
    "title": "my_index"
  }
}
Run Code Online (Sandbox Code Playgroud)

但是当我调用它时,出现以下错误:

{
  "error" : "no handler found for uri [/api/saved_objects/index-pattern/my_index_pattern?pretty=true] and method [POST]"
}
Run Code Online (Sandbox Code Playgroud)

我该如何解决?Opensearch 是否有不同的要求来创建index_pattern

小智 1

curl -k -X POST http://<host>:5601/api/saved_objects/index-pattern/logs-* -H "osd-xsrf:true" -H "content-type:application/json" -d '
{
  "attributes": {
    "title": "logs-*",
    "timeFieldName": "@timestamp"
   }
}'
Run Code Online (Sandbox Code Playgroud)

这对我有用