Skip to content

Commit be1bb0e

Browse files
authored
Remove types from Monitoring plugin "backend" code (#37745)
This PR removes the use of document types from the monitoring exporters and template + watches setup code. It does not remove the notion of types from the monitoring bulk API endpoint "front end" code as that code will eventually just go away in 8.0 and be replaced with Beats as collectors/shippers directly to the monitoring cluster.
1 parent ab11503 commit be1bb0e

File tree

12 files changed

+14
-22
lines changed

12 files changed

+14
-22
lines changed

x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExportBulk.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ private byte[] toBulkBytes(final MonitoringDoc doc) throws IOException {
143143
builder.startObject("index");
144144
{
145145
builder.field("_index", index);
146-
builder.field("_type", "doc");
147146
if (id != null) {
148147
builder.field("_id", id);
149148
}
@@ -163,7 +162,10 @@ private byte[] toBulkBytes(final MonitoringDoc doc) throws IOException {
163162
// Adds final bulk separator
164163
out.write(xContent.streamSeparator());
165164

166-
logger.trace("added index request [index={}, type={}, id={}]", index, doc.getType(), id);
165+
logger.trace(
166+
"http exporter [{}] - added index request [index={}, id={}, monitoring data type={}]",
167+
name, index, id, doc.getType()
168+
);
167169

168170
return BytesReference.toBytes(out.bytes());
169171
} catch (Exception e) {

x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalBulk.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void doAdd(Collection<MonitoringDoc> docs) throws ExportException {
6666
try {
6767
final String index = MonitoringTemplateUtils.indexName(formatter, doc.getSystem(), doc.getTimestamp());
6868

69-
final IndexRequest request = new IndexRequest(index, "doc");
69+
final IndexRequest request = new IndexRequest(index);
7070
if (Strings.hasText(doc.getId())) {
7171
request.id(doc.getId());
7272
}
@@ -82,8 +82,8 @@ public void doAdd(Collection<MonitoringDoc> docs) throws ExportException {
8282
requestBuilder.add(request);
8383

8484
if (logger.isTraceEnabled()) {
85-
logger.trace("local exporter [{}] - added index request [index={}, type={}, id={}, pipeline={}]",
86-
name, request.index(), request.type(), request.id(), request.getPipeline());
85+
logger.trace("local exporter [{}] - added index request [index={}, id={}, pipeline={}, monitoring data type={}]",
86+
name, request.index(), request.id(), request.getPipeline(), doc.getType());
8787
}
8888
} catch (Exception e) {
8989
if (exception == null) {

x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_cluster_status.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@
152152
"add_to_alerts_index": {
153153
"index": {
154154
"index": ".monitoring-alerts-6",
155-
"doc_type": "doc",
156155
"doc_id": "${monitoring.watch.unique_id}"
157156
}
158157
},

x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_nodes.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@
157157
"actions": {
158158
"add_to_alerts_index": {
159159
"index": {
160-
"index": ".monitoring-alerts-6",
161-
"doc_type": "doc"
160+
"index": ".monitoring-alerts-6"
162161
}
163162
},
164163
"send_email_to_admin": {

x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_version_mismatch.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@
148148
"add_to_alerts_index": {
149149
"index": {
150150
"index": ".monitoring-alerts-6",
151-
"doc_type": "doc",
152151
"doc_id": "${monitoring.watch.unique_id}"
153152
}
154153
},

x-pack/plugin/monitoring/src/main/resources/monitoring/watches/kibana_version_mismatch.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
"add_to_alerts_index": {
169169
"index": {
170170
"index": ".monitoring-alerts-6",
171-
"doc_type": "doc",
172171
"doc_id": "${monitoring.watch.unique_id}"
173172
}
174173
},

x-pack/plugin/monitoring/src/main/resources/monitoring/watches/logstash_version_mismatch.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
"add_to_alerts_index": {
169169
"index": {
170170
"index": ".monitoring-alerts-6",
171-
"doc_type": "doc",
172171
"doc_id": "${monitoring.watch.unique_id}"
173172
}
174173
},

x-pack/plugin/monitoring/src/main/resources/monitoring/watches/xpack_license_expiration.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141
"add_to_alerts_index": {
142142
"index": {
143143
"index": ".monitoring-alerts-6",
144-
"doc_type": "doc",
145144
"doc_id": "${monitoring.watch.unique_id}"
146145
}
147146
},

x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/action/MonitoringBulkRequestTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ public void testAddRequestContentWithUnrecognizedIndexName() throws IOException
232232
assertThat(e.getMessage(), containsString("unrecognized index name [" + indexName + "]"));
233233
//This test's JSON contains outdated references to types
234234
assertWarnings(RestBulkAction.TYPES_DEPRECATION_MESSAGE);
235-
236235
}
237236

238237
public void testSerialization() throws IOException {

x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/local/LocalExporterIntegTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ private void checkMonitoringDocs() {
275275
assertTrue("document is missing cluster_uuid field", Strings.hasText((String) source.get("cluster_uuid")));
276276
assertTrue("document is missing timestamp field", Strings.hasText(timestamp));
277277
assertTrue("document is missing type field", Strings.hasText(type));
278-
assertEquals("document _type is 'doc'", "doc", hit.getType());
279278

280279
@SuppressWarnings("unchecked")
281280
Map<String, Object> docSource = (Map<String, Object>) source.get("doc");

0 commit comments

Comments
 (0)