diff --git a/elasticsearch/x-pack/marvel/src/test/resources/rest-api-spec/api/monitoring.bulk.json b/elasticsearch/x-pack/marvel/src/test/resources/rest-api-spec/api/monitoring.bulk.json new file mode 100644 index 00000000000..b56bec67732 --- /dev/null +++ b/elasticsearch/x-pack/marvel/src/test/resources/rest-api-spec/api/monitoring.bulk.json @@ -0,0 +1,35 @@ +{ + "monitoring.bulk": { + "documentation": "http://www.elastic.co/guide/en/marvel/current/appendix-api-bulk.html", + "methods": ["POST", "PUT"], + "url": { + "path": "/_x-pack/monitoring/_bulk", + "paths": ["/_x-pack/monitoring/_bulk", "/_x-pack/monitoring/{index}/_bulk", "/_x-pack/monitoring/{index}/{type}/_bulk"], + "parts": { + "index": { + "type" : "string", + "description" : "Default index for items which don't provide one" + }, + "type": { + "type" : "string", + "description" : "Default document type for items which don't provide one" + } + }, + "params": { + "system_id": { + "type": "string", + "description" : "Identifier of the monitored system" + }, + "system_version" : { + "type" : "string", + "description" : "Version of the monitored system" + } + } + }, + "body": { + "description" : "The operation definition and data (action-data pairs), separated by newlines", + "required" : true, + "serialize" : "bulk" + } + } +} diff --git a/elasticsearch/x-pack/marvel/src/test/resources/rest-api-spec/test/monitoring/bulk/10_basic.yaml b/elasticsearch/x-pack/marvel/src/test/resources/rest-api-spec/test/monitoring/bulk/10_basic.yaml new file mode 100644 index 00000000000..1e1f472cf9a --- /dev/null +++ b/elasticsearch/x-pack/marvel/src/test/resources/rest-api-spec/test/monitoring/bulk/10_basic.yaml @@ -0,0 +1,78 @@ +--- +"Bulk indexing of monitoring data": + # Get the current version + - do: {info: {}} + - set: {version.number: version} + + - do: + monitoring.bulk: + system_id: "kibana" + system_version: $version + body: + - index: + _type: test_type + - avg-cpu: + user: 13.26 + nice: 0.17 + system: 1.51 + iowait: 0.85 + idle: 84.20 + + - index: + _type: test_type + - avg-cpu: + user: 13.23 + nice: 0.17 + system: 1.51 + iowait: 0.85 + idle: 84.24 + + - is_false: errors + + - do: + indices.refresh: {} + + - do: + count: + index: .monitoring-kibana-* + + - match: {count: 2} + +--- +"Bulk indexing of monitoring data using default type": + # Get the current version + - do: {info: {}} + - set: {version.number: version} + + - do: + monitoring.bulk: + system_id: "kibana" + system_version: $version + index: "default_index" + type: "default_type" + body: + - '{"index": {}}' + - '{"field_1": "value_1"}' + - '{"index": {"_type": "test_type"}}' + - '{"field_1": "value_2"}' + - '{"index": {}}' + - '{"field_1": "value_3"}' + + - is_false: errors + + - do: + indices.refresh: {} + + - do: + search: + index: .monitoring-kibana-* + type: default_type + + - match: { hits.total: 2 } + + - do: + search: + index: .monitoring-kibana-* + type: test_type + + - match: { hits.total: 1 }