Hi!
I noticed there was a thread here: Problem creating index pattern from CURL where people talked about doing it on Open Source Elastic and Kibana. I imagine some of the steps might be the same. Also, there’s a github issue talking about this briefly as well:
opened 12:39PM - 05 Nov 21 UTC
bug
Hi,
I am trying to create index_pattern via API, but I do for sure something w… rong.
If I give
`curl -s -k -u admin:pw -XPOST "https://my-opensearch.local:9200/api/opensearch-dashboards/index_patterns/" -H "kbn-xsrf: true" -H "Content-Type: application/json; charset=utf-8" -H "securitytenant: test-tenant2" -d '{"attributes": {"title": "test-opensearch-*","timeFieldName": "@timestamp"} }'| jq -r`
then I get a success message but I cant find the index_pattern nowhere:
```
{
"_index": "api",
"_type": "opensearch-dashboards",
"_id": "index_patterns",
"_version": 10,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 17,
"_primary_term": 1
}
```
On the other hand if I give
`curl -s -k -u admin:pw -XPOST "https://my-opensearch.local:9200/api/saved_objects/index_patterns/" -H "kbn-xsrf: true" -H "Content-Type: application/json; charset=utf-8" -H "securitytenant: test-tenant2" -d '{"attributes": {"title": "test-opensearch-*","timeFieldName": "@timestamp"} }'| jq -r`
then I get the following message:
```
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [api] as the final mapping would have more than 1 type: [opensearch-dashboards, saved_objects]"
}
],
"type": "illegal_argument_exception",
"reason": "Rejecting mapping update to [api] as the final mapping would have more than 1 type: [opensearch-dashboards, saved_objects]"
},
"status": 400
}
```
I tried with the method you described [hier](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/DEVELOPER_GUIDE.md#api-endpoints) too, but no success.
Could you please provide a complete example on how to create index_patterns with API?
Thanks a lot
Davide
You might find some answers between those two threads. I’m still trying to recreate their steps.
Nate