Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
OpenSearch 2.13 (latest)
Describe the issue:
Context: So I am exporting cloudtrail logs into the opensearch cluster. And I have a difficult time understanding the correct terraform configuration for the JSON
I created some object with the UI and now im trying to accomplish this with terraform. In opensearch you can see your JSON configuration in Dashboard management > Saved objects > Edit visualization
but Im very unsure how to configure that into the Terraform JSON cause to me they dont seems the same maybe im missing some documentation?
Configuration:
If we take and UI Created dashboad object as an example we get these 3 json objects:
visState
{
"title": "Source Ip Addresses",
"type": "table",
"aggs": [
{
"id": "1",
"enabled": true,
"type": "count",
"params": {},
"schema": "metric"
},
{
"id": "2",
"enabled": true,
"type": "significant_terms",
"params": {
"field": "sourceIPAddress.keyword",
"size": 500,
"customLabel": "Source Ip addresses"
},
"schema": "bucket"
}
],
"params": {
"perPage": 10,
"showPartialRows": false,
"showMetricsAtAllLevels": false,
"showTotal": false,
"totalFunc": "sum",
"percentageCol": ""
}
}
kibanaSavedObjectMeta.searchSourceJSON
{
"query": {
"query": "",
"language": "kuery"
},
"filter": [
{
"$state": {
"store": "appState"
},
"exists": {
"field": "sourceIPAddress"
},
"meta": {
"alias": null,
"disabled": false,
"key": "sourceIPAddress",
"negate": false,
"type": "exists",
"value": "exists",
"indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index"
}
}
],
"indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index"
}
references
[
{
"name": "kibanaSavedObjectMeta.searchSourceJSON.index",
"type": "index-pattern",
"id": "035e2760-24d9-11ef-962f-672ae61b9dd9"
},
{
"name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index",
"type": "index-pattern",
"id": "035e2760-24d9-11ef-962f-672ae61b9dd9"
}
]
But I dont understand how that translate to this example (from terraform) cause the visState is defined but where should the kibanaSavedObjectMeta.searchSourceJSON and references be?:
resource "opensearch_dashboard_object" "test_visualization_v6" {
body = <<EOF
[
{
"_id": "visualization:response-time-percentile",
"_type": "doc",
"_source": {
"type": "visualization",
"visualization": {
"title": "Total response time percentiles",
"visState": {<Here comes the visState>},
"uiStateJSON": "{}",
"description": "",
"version": 1
}
}
}
]
EOF
}
Im sorry if im missing something but all help would be appreciated