diff --git a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/resolver/shards/ShardsResolver.java b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/resolver/shards/ShardsResolver.java index ca4288b9617..c5064d7eb71 100644 --- a/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/resolver/shards/ShardsResolver.java +++ b/elasticsearch/x-pack/marvel/src/main/java/org/elasticsearch/marvel/agent/resolver/shards/ShardsResolver.java @@ -60,7 +60,7 @@ public class ShardsResolver extends MonitoringIndexNameResolver.Timestamped source = searchHit.sourceAsMap(); - assertNotNull(source.get(MonitoringBulkResolver.Fields.CLUSTER_UUID.underscore().toString())); - assertNotNull(source.get(MonitoringBulkResolver.Fields.TIMESTAMP.underscore().toString())); - assertNotNull(source.get(MonitoringBulkResolver.Fields.SOURCE_NODE.underscore().toString())); + assertNotNull(source.get(MonitoringBulkResolver.Fields.CLUSTER_UUID.value())); + assertNotNull(source.get(MonitoringBulkResolver.Fields.TIMESTAMP.value())); + assertNotNull(source.get(MonitoringBulkResolver.Fields.SOURCE_NODE.value())); } } diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/MonitoringIndexNameResolverTestCase.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/MonitoringIndexNameResolverTestCase.java index 3c2fdb0e9a1..bc4177cf787 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/MonitoringIndexNameResolverTestCase.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/MonitoringIndexNameResolverTestCase.java @@ -148,9 +148,9 @@ public abstract class MonitoringIndexNameResolverTestCase source = response.getSource(); - assertThat(source.get(MonitoringIndexNameResolver.Fields.CLUSTER_UUID.underscore().toString()), notNullValue()); - assertThat(source.get(MonitoringIndexNameResolver.Fields.TIMESTAMP.underscore().toString()), notNullValue()); - assertThat(source.get(MonitoringIndexNameResolver.Fields.SOURCE_NODE.underscore().toString()), notNullValue()); - assertThat(source.get(ClusterInfoResolver.Fields.CLUSTER_NAME.underscore().toString()), equalTo(cluster().getClusterName())); - assertThat(source.get(ClusterInfoResolver.Fields.VERSION.underscore().toString()), equalTo(Version.CURRENT.toString())); + assertThat(source.get(MonitoringIndexNameResolver.Fields.CLUSTER_UUID.value()), notNullValue()); + assertThat(source.get(MonitoringIndexNameResolver.Fields.TIMESTAMP.value()), notNullValue()); + assertThat(source.get(MonitoringIndexNameResolver.Fields.SOURCE_NODE.value()), notNullValue()); + assertThat(source.get(ClusterInfoResolver.Fields.CLUSTER_NAME.value()), equalTo(cluster().getClusterName())); + assertThat(source.get(ClusterInfoResolver.Fields.VERSION.value()), equalTo(Version.CURRENT.toString())); logger.debug("--> checking that the document contains license information"); - Object licenseObj = source.get(ClusterInfoResolver.Fields.LICENSE.underscore().toString()); + Object licenseObj = source.get(ClusterInfoResolver.Fields.LICENSE.value()); assertThat(licenseObj, instanceOf(Map.class)); Map license = (Map) licenseObj; assertThat(license, instanceOf(Map.class)); - String uid = (String) license.get(ClusterInfoResolver.Fields.UID.underscore().toString()); + String uid = (String) license.get(ClusterInfoResolver.Fields.UID.value()); assertThat(uid, not(isEmptyOrNullString())); - String type = (String) license.get(ClusterInfoResolver.Fields.TYPE.underscore().toString()); + String type = (String) license.get(ClusterInfoResolver.Fields.TYPE.value()); assertThat(type, not(isEmptyOrNullString())); - String status = (String) license.get(License.XFields.STATUS.underscore().toString()); + String status = (String) license.get(License.XFields.STATUS.value()); assertThat(status, not(isEmptyOrNullString())); - Long expiryDate = (Long) license.get(License.XFields.EXPIRY_DATE_IN_MILLIS.underscore().toString()); + Long expiryDate = (Long) license.get(License.XFields.EXPIRY_DATE_IN_MILLIS.value()); assertThat(expiryDate, greaterThan(0L)); // We basically recompute the hash here - String hkey = (String) license.get(ClusterInfoResolver.Fields.HKEY.underscore().toString()); + String hkey = (String) license.get(ClusterInfoResolver.Fields.HKEY.value()); String recalculated = ClusterInfoResolver.hash(status, uid, type, String.valueOf(expiryDate), clusterUUID); assertThat(hkey, equalTo(recalculated)); - assertThat((String) license.get(License.XFields.ISSUER.underscore().toString()), not(isEmptyOrNullString())); - assertThat((String) license.get(License.XFields.ISSUED_TO.underscore().toString()), not(isEmptyOrNullString())); - assertThat((Long) license.get(License.XFields.ISSUE_DATE_IN_MILLIS.underscore().toString()), greaterThan(0L)); - assertThat((Integer) license.get(License.XFields.MAX_NODES.underscore().toString()), greaterThan(0)); + assertThat((String) license.get(License.XFields.ISSUER.value()), not(isEmptyOrNullString())); + assertThat((String) license.get(License.XFields.ISSUED_TO.value()), not(isEmptyOrNullString())); + assertThat((Long) license.get(License.XFields.ISSUE_DATE_IN_MILLIS.value()), greaterThan(0L)); + assertThat((Integer) license.get(License.XFields.MAX_NODES.value()), greaterThan(0)); - Object clusterStats = source.get(ClusterInfoResolver.Fields.CLUSTER_STATS.underscore().toString()); + Object clusterStats = source.get(ClusterInfoResolver.Fields.CLUSTER_STATS.value()); assertNotNull(clusterStats); assertThat(clusterStats, instanceOf(Map.class)); assertThat(((Map) clusterStats).size(), greaterThan(0)); @@ -128,10 +128,10 @@ public class ClusterInfoTests extends MarvelIntegTestCase { .setTypes(ClusterInfoResolver.TYPE) .setQuery( QueryBuilders.boolQuery() - .should(QueryBuilders.matchQuery(License.XFields.STATUS.underscore().toString(), License.Status.ACTIVE.label())) - .should(QueryBuilders.matchQuery(License.XFields.STATUS.underscore().toString(), License.Status.INVALID.label())) - .should(QueryBuilders.matchQuery(License.XFields.STATUS.underscore().toString(), License.Status.EXPIRED.label())) - .should(QueryBuilders.matchQuery(ClusterInfoResolver.Fields.CLUSTER_NAME.underscore().toString(), + .should(QueryBuilders.matchQuery(License.XFields.STATUS.value(), License.Status.ACTIVE.label())) + .should(QueryBuilders.matchQuery(License.XFields.STATUS.value(), License.Status.INVALID.label())) + .should(QueryBuilders.matchQuery(License.XFields.STATUS.value(), License.Status.EXPIRED.label())) + .should(QueryBuilders.matchQuery(ClusterInfoResolver.Fields.CLUSTER_NAME.value(), cluster().getClusterName())) .minimumNumberShouldMatch(1) ).get(), 0L); diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/cluster/ClusterStateTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/cluster/ClusterStateTests.java index f71e20ddc73..e58e13fd81c 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/cluster/ClusterStateTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/cluster/ClusterStateTests.java @@ -122,13 +122,13 @@ public class ClusterStateTests extends MarvelIntegTestCase { logger.debug("--> checking that every document contains the expected fields"); String[] filters = { - MonitoringIndexNameResolver.Fields.CLUSTER_UUID.underscore().toString(), - MonitoringIndexNameResolver.Fields.TIMESTAMP.underscore().toString(), - SOURCE_NODE.underscore().toString(), - ClusterStateNodeResolver.Fields.STATE_UUID.underscore().toString(), - ClusterStateNodeResolver.Fields.NODE.underscore().toString(), - ClusterStateNodeResolver.Fields.NODE.underscore().toString() + "." - + ClusterStateNodeResolver.Fields.ID.underscore().toString(), + MonitoringIndexNameResolver.Fields.CLUSTER_UUID.value(), + MonitoringIndexNameResolver.Fields.TIMESTAMP.value(), + SOURCE_NODE.value(), + ClusterStateNodeResolver.Fields.STATE_UUID.value(), + ClusterStateNodeResolver.Fields.NODE.value(), + ClusterStateNodeResolver.Fields.NODE.value() + "." + + ClusterStateNodeResolver.Fields.ID.value(), }; for (SearchHit searchHit : response.getHits().getHits()) { @@ -143,7 +143,7 @@ public class ClusterStateTests extends MarvelIntegTestCase { assertThat(client().prepareSearch().setSize(0) .setIndices(timestampedIndex) .setTypes(ClusterStateNodeResolver.TYPE) - .setQuery(QueryBuilders.matchQuery(SOURCE_NODE.underscore().toString() + ".attributes.custom", randomInt)) + .setQuery(QueryBuilders.matchQuery(SOURCE_NODE.value() + ".attributes.custom", randomInt)) .get().getHits().getTotalHits(), greaterThan(0L)); logger.debug("--> cluster state nodes successfully collected"); @@ -167,18 +167,18 @@ public class ClusterStateTests extends MarvelIntegTestCase { logger.debug("--> checking that every document contains the expected fields"); String[] filters = { - MonitoringIndexNameResolver.Fields.CLUSTER_UUID.underscore().toString(), - MonitoringIndexNameResolver.Fields.TIMESTAMP.underscore().toString(), - MonitoringIndexNameResolver.Fields.SOURCE_NODE.underscore().toString(), - DiscoveryNodeResolver.Fields.NODE.underscore().toString(), - DiscoveryNodeResolver.Fields.NODE.underscore().toString() + "." - + DiscoveryNodeResolver.Fields.ID.underscore().toString(), - DiscoveryNodeResolver.Fields.NODE.underscore().toString() + "." - + DiscoveryNodeResolver.Fields.NAME.underscore().toString(), - DiscoveryNodeResolver.Fields.NODE.underscore().toString() + "." - + DiscoveryNodeResolver.Fields.ATTRIBUTES.underscore().toString(), - DiscoveryNodeResolver.Fields.NODE.underscore().toString() + "." - + DiscoveryNodeResolver.Fields.TRANSPORT_ADDRESS.underscore().toString(), + MonitoringIndexNameResolver.Fields.CLUSTER_UUID.value(), + MonitoringIndexNameResolver.Fields.TIMESTAMP.value(), + MonitoringIndexNameResolver.Fields.SOURCE_NODE.value(), + DiscoveryNodeResolver.Fields.NODE.value(), + DiscoveryNodeResolver.Fields.NODE.value() + "." + + DiscoveryNodeResolver.Fields.ID.value(), + DiscoveryNodeResolver.Fields.NODE.value() + "." + + DiscoveryNodeResolver.Fields.NAME.value(), + DiscoveryNodeResolver.Fields.NODE.value() + "." + + DiscoveryNodeResolver.Fields.ATTRIBUTES.value(), + DiscoveryNodeResolver.Fields.NODE.value() + "." + + DiscoveryNodeResolver.Fields.TRANSPORT_ADDRESS.value(), }; for (SearchHit searchHit : response.getHits().getHits()) { diff --git a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndexRecoveryTests.java b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndexRecoveryTests.java index 41f155d85da..1f15944cf66 100644 --- a/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndexRecoveryTests.java +++ b/elasticsearch/x-pack/marvel/src/test/java/org/elasticsearch/marvel/agent/resolver/indices/IndexRecoveryTests.java @@ -80,12 +80,12 @@ public class IndexRecoveryTests extends MarvelIntegTestCase { logger.debug("--> checking that every document contains the expected fields"); String[] filters = { - MonitoringIndexNameResolver.Fields.CLUSTER_UUID.underscore().toString(), - MonitoringIndexNameResolver.Fields.TIMESTAMP.underscore().toString(), - MonitoringIndexNameResolver.Fields.SOURCE_NODE.underscore().toString(), - IndexRecoveryResolver.Fields.INDEX_RECOVERY.underscore().toString(), - IndexRecoveryResolver.Fields.INDEX_RECOVERY.underscore().toString() + "." - + IndexRecoveryResolver.Fields.SHARDS.underscore().toString(), + MonitoringIndexNameResolver.Fields.CLUSTER_UUID.value(), + MonitoringIndexNameResolver.Fields.TIMESTAMP.value(), + MonitoringIndexNameResolver.Fields.SOURCE_NODE.value(), + IndexRecoveryResolver.Fields.INDEX_RECOVERY.value(), + IndexRecoveryResolver.Fields.INDEX_RECOVERY.value() + "." + + IndexRecoveryResolver.Fields.SHARDS.value(), }; for (SearchHit searchHit : response.getHits().getHits()) {