From 523b071836be9c9b954c9e45a026311c83483c05 Mon Sep 17 00:00:00 2001 From: Ryan Ernst <ryan@iernst.net> Date: Mon, 18 Apr 2016 14:32:18 -0700 Subject: [PATCH] Internal: Remove XContentBuilderString This was previously used by xcontentbuilder to support camelCase. However, it is no longer used, and can be replaced with just String. --- .../action/DocWriteResponse.java | 9 +- .../action/ReplicationResponse.java | 25 +- .../cluster/health/ClusterHealthResponse.java | 39 +- .../verify/VerifyRepositoryResponse.java | 5 +- .../create/CreateSnapshotResponse.java | 5 +- .../snapshots/get/GetSnapshotsResponse.java | 3 +- .../restore/RestoreSnapshotResponse.java | 5 +- .../status/SnapshotIndexShardStatus.java | 7 +- .../snapshots/status/SnapshotIndexStatus.java | 3 +- .../snapshots/status/SnapshotShardsStats.java | 15 +- .../snapshots/status/SnapshotStats.java | 21 +- .../snapshots/status/SnapshotStatus.java | 9 +- .../status/SnapshotsStatusResponse.java | 3 +- .../cluster/stats/ClusterStatsIndices.java | 23 +- .../cluster/stats/ClusterStatsNodes.java | 67 ++- .../cluster/stats/ClusterStatsResponse.java | 11 +- .../tasks/PendingClusterTasksResponse.java | 15 +- .../indices/analyze/AnalyzeResponse.java | 15 +- .../analyze/DetailAnalyzeResponse.java | 15 +- .../indices/flush/SyncedFlushResponse.java | 17 +- .../segments/IndicesSegmentResponse.java | 51 ++- .../shards/IndicesShardStoresResponse.java | 17 +- .../indices/stats/IndicesStatsResponse.java | 5 +- .../admin/indices/stats/ShardStats.java | 19 +- .../upgrade/get/UpgradeStatusResponse.java | 27 +- .../action/bulk/BulkItemResponse.java | 11 +- .../action/delete/DeleteResponse.java | 3 +- .../action/fieldstats/FieldStats.java | 19 +- .../action/get/MultiGetResponse.java | 15 +- .../action/index/IndexResponse.java | 3 +- .../ingest/SimulatePipelineResponse.java | 3 +- .../percolate/MultiPercolateResponse.java | 5 +- .../action/percolate/PercolateResponse.java | 15 +- .../action/search/ClearScrollResponse.java | 5 +- .../action/search/MultiSearchResponse.java | 9 +- .../action/search/SearchResponse.java | 9 +- .../termvectors/MultiTermVectorsResponse.java | 11 +- .../termvectors/TermVectorsResponse.java | 47 ++- .../action/update/UpdateResponse.java | 3 +- .../cluster/SnapshotsInProgress.java | 27 +- .../cluster/health/ClusterIndexHealth.java | 23 +- .../elasticsearch/common/unit/Fuzziness.java | 5 +- .../common/xcontent/XContentBuilder.java | 381 +----------------- .../xcontent/XContentBuilderString.java | 36 -- .../common/xcontent/XContentGenerator.java | 23 -- .../common/xcontent/XContentParser.java | 4 +- .../common/xcontent/XContentString.java | 32 -- .../xcontent/json/JsonXContentGenerator.java | 66 --- .../discovery/DiscoveryStats.java | 3 +- .../zen/publish/PendingClusterStateStats.java | 9 +- .../java/org/elasticsearch/http/HttpInfo.java | 11 +- .../org/elasticsearch/http/HttpStats.java | 9 +- .../index/cache/query/QueryCacheStats.java | 19 +- .../cache/request/RequestCacheStats.java | 13 +- .../index/engine/CommitStats.java | 11 +- .../index/engine/SegmentsStats.java | 57 ++- .../index/fielddata/FieldDataStats.java | 11 +- .../elasticsearch/index/flush/FlushStats.java | 11 +- .../elasticsearch/index/get/GetResult.java | 13 +- .../org/elasticsearch/index/get/GetStats.java | 23 +- .../elasticsearch/index/merge/MergeStats.java | 35 +- .../percolator/PercolatorQueryCacheStats.java | 5 +- .../index/recovery/RecoveryStats.java | 11 +- .../index/refresh/RefreshStats.java | 11 +- .../index/search/stats/SearchStats.java | 39 +- .../elasticsearch/index/shard/DocsStats.java | 7 +- .../index/shard/IndexingStats.java | 31 +- .../BlobStoreIndexShardSnapshot.java | 29 +- .../BlobStoreIndexShardSnapshots.java | 5 +- .../elasticsearch/index/store/StoreStats.java | 11 +- .../index/translog/TranslogStats.java | 9 +- .../index/warmer/WarmerStats.java | 13 +- .../indices/NodeIndicesStats.java | 3 +- .../breaker/AllCircuitBreakerStats.java | 3 +- .../indices/breaker/CircuitBreakerStats.java | 13 +- .../indices/recovery/RecoveryState.java | 77 ++-- .../org/elasticsearch/monitor/fs/FsInfo.java | 29 +- .../elasticsearch/monitor/jvm/JvmInfo.java | 45 +-- .../elasticsearch/monitor/jvm/JvmStats.java | 83 ++-- .../org/elasticsearch/monitor/os/OsInfo.java | 17 +- .../org/elasticsearch/monitor/os/OsStats.java | 37 +- .../monitor/process/ProcessInfo.java | 11 +- .../monitor/process/ProcessStats.java | 23 +- .../org/elasticsearch/plugins/PluginInfo.java | 11 +- .../cluster/state/RestClusterStateAction.java | 3 +- .../alias/get/RestGetAliasesAction.java | 3 +- .../indices/get/RestGetIndicesAction.java | 7 +- .../mapping/get/RestGetMappingAction.java | 3 +- .../query/RestValidateQueryAction.java | 11 +- .../rest/action/bulk/RestBulkAction.java | 9 +- .../action/explain/RestExplainAction.java | 19 +- .../script/RestDeleteIndexedScriptAction.java | 11 +- .../script/RestGetIndexedScriptAction.java | 13 +- .../script/RestPutIndexedScriptAction.java | 7 +- .../support/AcknowledgedRestListener.java | 3 +- .../rest/action/support/RestActions.java | 11 +- .../template/RestGetSearchTemplateAction.java | 5 +- .../org/elasticsearch/script/ScriptStats.java | 7 +- .../aggregations/InternalAggregation.java | 25 +- .../aggregations/InternalAggregations.java | 3 +- .../geocentroid/InternalGeoCentroid.java | 3 +- .../metrics/stats/InternalStats.java | 19 +- .../stats/extended/InternalExtendedStats.java | 21 +- .../search/internal/InternalSearchHit.java | 35 +- .../search/internal/InternalSearchHits.java | 7 +- .../elasticsearch/search/suggest/Suggest.java | 19 +- .../suggest/completion/CompletionStats.java | 9 +- .../suggest/phrase/PhraseSuggestion.java | 3 +- .../search/suggest/term/TermSuggestion.java | 3 +- .../elasticsearch/snapshots/RestoreInfo.java | 15 +- .../org/elasticsearch/snapshots/Snapshot.java | 23 +- .../elasticsearch/snapshots/SnapshotInfo.java | 33 +- .../elasticsearch/threadpool/ThreadPool.java | 11 +- .../threadpool/ThreadPoolInfo.java | 3 +- .../threadpool/ThreadPoolStats.java | 15 +- .../transport/TransportInfo.java | 9 +- .../transport/TransportStats.java | 19 +- .../builder/XContentBuilderTests.java | 5 +- .../deletebyquery/DeleteByQueryResponse.java | 9 +- .../IndexDeleteByQueryResponse.java | 11 +- 120 files changed, 867 insertions(+), 1479 deletions(-) delete mode 100644 core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilderString.java delete mode 100644 core/src/main/java/org/elasticsearch/common/xcontent/XContentString.java diff --git a/core/src/main/java/org/elasticsearch/action/DocWriteResponse.java b/core/src/main/java/org/elasticsearch/action/DocWriteResponse.java index 76093aa9cb7..4df43b75401 100644 --- a/core/src/main/java/org/elasticsearch/action/DocWriteResponse.java +++ b/core/src/main/java/org/elasticsearch/action/DocWriteResponse.java @@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.StatusToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.rest.RestStatus; @@ -110,10 +109,10 @@ public abstract class DocWriteResponse extends ReplicationResponse implements St } static final class Fields { - static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - static final XContentBuilderString _TYPE = new XContentBuilderString("_type"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); - static final XContentBuilderString _VERSION = new XContentBuilderString("_version"); + static final String _INDEX = "_index"; + static final String _TYPE = "_type"; + static final String _ID = "_id"; + static final String _VERSION = "_version"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/ReplicationResponse.java b/core/src/main/java/org/elasticsearch/action/ReplicationResponse.java index 8a81446d459..df2f90b0020 100644 --- a/core/src/main/java/org/elasticsearch/action/ReplicationResponse.java +++ b/core/src/main/java/org/elasticsearch/action/ReplicationResponse.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.rest.RestStatus; @@ -280,24 +279,24 @@ public class ReplicationResponse extends ActionResponse { private static class Fields { - private static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - private static final XContentBuilderString _SHARD = new XContentBuilderString("_shard"); - private static final XContentBuilderString _NODE = new XContentBuilderString("_node"); - private static final XContentBuilderString REASON = new XContentBuilderString("reason"); - private static final XContentBuilderString STATUS = new XContentBuilderString("status"); - private static final XContentBuilderString PRIMARY = new XContentBuilderString("primary"); + private static final String _INDEX = "_index"; + private static final String _SHARD = "_shard"; + private static final String _NODE = "_node"; + private static final String REASON = "reason"; + private static final String STATUS = "status"; + private static final String PRIMARY = "primary"; } } private static class Fields { - private static final XContentBuilderString _SHARDS = new XContentBuilderString("_shards"); - private static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - private static final XContentBuilderString SUCCESSFUL = new XContentBuilderString("successful"); - private static final XContentBuilderString PENDING = new XContentBuilderString("pending"); - private static final XContentBuilderString FAILED = new XContentBuilderString("failed"); - private static final XContentBuilderString FAILURES = new XContentBuilderString("failures"); + private static final String _SHARDS = "_shards"; + private static final String TOTAL = "total"; + private static final String SUCCESSFUL = "successful"; + private static final String PENDING = "pending"; + private static final String FAILED = "failed"; + private static final String FAILURES = "failures"; } } diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java index 7c0bd350289..d9b95af8516 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.StatusToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.rest.RestStatus; @@ -234,25 +233,25 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo } static final class Fields { - static final XContentBuilderString CLUSTER_NAME = new XContentBuilderString("cluster_name"); - static final XContentBuilderString STATUS = new XContentBuilderString("status"); - static final XContentBuilderString TIMED_OUT = new XContentBuilderString("timed_out"); - static final XContentBuilderString NUMBER_OF_NODES = new XContentBuilderString("number_of_nodes"); - static final XContentBuilderString NUMBER_OF_DATA_NODES = new XContentBuilderString("number_of_data_nodes"); - static final XContentBuilderString NUMBER_OF_PENDING_TASKS = new XContentBuilderString("number_of_pending_tasks"); - static final XContentBuilderString NUMBER_OF_IN_FLIGHT_FETCH = new XContentBuilderString("number_of_in_flight_fetch"); - static final XContentBuilderString DELAYED_UNASSIGNED_SHARDS = new XContentBuilderString("delayed_unassigned_shards"); - static final XContentBuilderString TASK_MAX_WAIT_TIME_IN_QUEUE = new XContentBuilderString("task_max_waiting_in_queue"); - static final XContentBuilderString TASK_MAX_WAIT_TIME_IN_QUEUE_IN_MILLIS = new XContentBuilderString("task_max_waiting_in_queue_millis"); - static final XContentBuilderString ACTIVE_SHARDS_PERCENT_AS_NUMBER = new XContentBuilderString("active_shards_percent_as_number"); - static final XContentBuilderString ACTIVE_SHARDS_PERCENT = new XContentBuilderString("active_shards_percent"); - static final XContentBuilderString ACTIVE_PRIMARY_SHARDS = new XContentBuilderString("active_primary_shards"); - static final XContentBuilderString ACTIVE_SHARDS = new XContentBuilderString("active_shards"); - static final XContentBuilderString RELOCATING_SHARDS = new XContentBuilderString("relocating_shards"); - static final XContentBuilderString INITIALIZING_SHARDS = new XContentBuilderString("initializing_shards"); - static final XContentBuilderString UNASSIGNED_SHARDS = new XContentBuilderString("unassigned_shards"); - static final XContentBuilderString VALIDATION_FAILURES = new XContentBuilderString("validation_failures"); - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); + static final String CLUSTER_NAME = "cluster_name"; + static final String STATUS = "status"; + static final String TIMED_OUT = "timed_out"; + static final String NUMBER_OF_NODES = "number_of_nodes"; + static final String NUMBER_OF_DATA_NODES = "number_of_data_nodes"; + static final String NUMBER_OF_PENDING_TASKS = "number_of_pending_tasks"; + static final String NUMBER_OF_IN_FLIGHT_FETCH = "number_of_in_flight_fetch"; + static final String DELAYED_UNASSIGNED_SHARDS = "delayed_unassigned_shards"; + static final String TASK_MAX_WAIT_TIME_IN_QUEUE = "task_max_waiting_in_queue"; + static final String TASK_MAX_WAIT_TIME_IN_QUEUE_IN_MILLIS = "task_max_waiting_in_queue_millis"; + static final String ACTIVE_SHARDS_PERCENT_AS_NUMBER = "active_shards_percent_as_number"; + static final String ACTIVE_SHARDS_PERCENT = "active_shards_percent"; + static final String ACTIVE_PRIMARY_SHARDS = "active_primary_shards"; + static final String ACTIVE_SHARDS = "active_shards"; + static final String RELOCATING_SHARDS = "relocating_shards"; + static final String INITIALIZING_SHARDS = "initializing_shards"; + static final String UNASSIGNED_SHARDS = "unassigned_shards"; + static final String VALIDATION_FAILURES = "validation_failures"; + static final String INDICES = "indices"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryResponse.java index 11020beac4a..823487155f5 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryResponse.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentHelper; import java.io.IOException; @@ -78,8 +77,8 @@ public class VerifyRepositoryResponse extends ActionResponse implements ToXConte } static final class Fields { - static final XContentBuilderString NODES = new XContentBuilderString("nodes"); - static final XContentBuilderString NAME = new XContentBuilderString("name"); + static final String NODES = "nodes"; + static final String NAME = "name"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotResponse.java index c1c5e9f4658..0be07c703f1 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotResponse.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.snapshots.SnapshotInfo; @@ -83,8 +82,8 @@ public class CreateSnapshotResponse extends ActionResponse implements ToXContent } static final class Fields { - static final XContentBuilderString SNAPSHOT = new XContentBuilderString("snapshot"); - static final XContentBuilderString ACCEPTED = new XContentBuilderString("accepted"); + static final String SNAPSHOT = "snapshot"; + static final String ACCEPTED = "accepted"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java index 4ca88daad54..65b0e4faa4a 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.snapshots.SnapshotInfo; import java.io.IOException; @@ -76,7 +75,7 @@ public class GetSnapshotsResponse extends ActionResponse implements ToXContent { } static final class Fields { - static final XContentBuilderString SNAPSHOTS = new XContentBuilderString("snapshots"); + static final String SNAPSHOTS = "snapshots"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponse.java index 0101b95acc7..a54c01ed15a 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponse.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.snapshots.RestoreInfo; @@ -75,8 +74,8 @@ public class RestoreSnapshotResponse extends ActionResponse implements ToXConten } static final class Fields { - static final XContentBuilderString SNAPSHOT = new XContentBuilderString("snapshot"); - static final XContentBuilderString ACCEPTED = new XContentBuilderString("accepted"); + static final String SNAPSHOT = "snapshot"; + static final String ACCEPTED = "accepted"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexShardStatus.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexShardStatus.java index 1f358915662..3d287eee9d1 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexShardStatus.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexShardStatus.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus; @@ -135,9 +134,9 @@ public class SnapshotIndexShardStatus extends BroadcastShardResponse implements } static final class Fields { - static final XContentBuilderString STAGE = new XContentBuilderString("stage"); - static final XContentBuilderString REASON = new XContentBuilderString("reason"); - static final XContentBuilderString NODE = new XContentBuilderString("node"); + static final String STAGE = "stage"; + static final String REASON = "reason"; + static final String NODE = "node"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexStatus.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexStatus.java index 87d153a83fd..16c361d5ca6 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexStatus.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotIndexStatus.java @@ -21,7 +21,6 @@ package org.elasticsearch.action.admin.cluster.snapshots.status; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Collection; @@ -91,7 +90,7 @@ public class SnapshotIndexStatus implements Iterable<SnapshotIndexShardStatus>, } static final class Fields { - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); + static final String SHARDS = "shards"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotShardsStats.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotShardsStats.java index ba3bd7a8c77..63bbed43182 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotShardsStats.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotShardsStats.java @@ -21,7 +21,6 @@ package org.elasticsearch.action.admin.cluster.snapshots.status; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Collection; @@ -106,13 +105,13 @@ public class SnapshotShardsStats implements ToXContent { } static final class Fields { - static final XContentBuilderString SHARDS_STATS = new XContentBuilderString("shards_stats"); - static final XContentBuilderString INITIALIZING = new XContentBuilderString("initializing"); - static final XContentBuilderString STARTED = new XContentBuilderString("started"); - static final XContentBuilderString FINALIZING = new XContentBuilderString("finalizing"); - static final XContentBuilderString DONE = new XContentBuilderString("done"); - static final XContentBuilderString FAILED = new XContentBuilderString("failed"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); + static final String SHARDS_STATS = "shards_stats"; + static final String INITIALIZING = "initializing"; + static final String STARTED = "started"; + static final String FINALIZING = "finalizing"; + static final String DONE = "done"; + static final String FAILED = "failed"; + static final String TOTAL = "total"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStats.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStats.java index 5dd2617fea2..2e0e3f993a1 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStats.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStats.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus; import java.io.IOException; @@ -130,16 +129,16 @@ public class SnapshotStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString STATS = new XContentBuilderString("stats"); - static final XContentBuilderString NUMBER_OF_FILES = new XContentBuilderString("number_of_files"); - static final XContentBuilderString PROCESSED_FILES = new XContentBuilderString("processed_files"); - static final XContentBuilderString TOTAL_SIZE_IN_BYTES = new XContentBuilderString("total_size_in_bytes"); - static final XContentBuilderString TOTAL_SIZE = new XContentBuilderString("total_size"); - static final XContentBuilderString PROCESSED_SIZE_IN_BYTES = new XContentBuilderString("processed_size_in_bytes"); - static final XContentBuilderString PROCESSED_SIZE = new XContentBuilderString("processed_size"); - static final XContentBuilderString START_TIME_IN_MILLIS = new XContentBuilderString("start_time_in_millis"); - static final XContentBuilderString TIME_IN_MILLIS = new XContentBuilderString("time_in_millis"); - static final XContentBuilderString TIME = new XContentBuilderString("time"); + static final String STATS = "stats"; + static final String NUMBER_OF_FILES = "number_of_files"; + static final String PROCESSED_FILES = "processed_files"; + static final String TOTAL_SIZE_IN_BYTES = "total_size_in_bytes"; + static final String TOTAL_SIZE = "total_size"; + static final String PROCESSED_SIZE_IN_BYTES = "processed_size_in_bytes"; + static final String PROCESSED_SIZE = "processed_size"; + static final String START_TIME_IN_MILLIS = "start_time_in_millis"; + static final String TIME_IN_MILLIS = "time_in_millis"; + static final String TIME = "time"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStatus.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStatus.java index 860b414fa3e..54f87f3c5fc 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStatus.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStatus.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import java.io.IOException; @@ -180,10 +179,10 @@ public class SnapshotStatus implements ToXContent, Streamable { } static final class Fields { - static final XContentBuilderString SNAPSHOT = new XContentBuilderString("snapshot"); - static final XContentBuilderString REPOSITORY = new XContentBuilderString("repository"); - static final XContentBuilderString STATE = new XContentBuilderString("state"); - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); + static final String SNAPSHOT = "snapshot"; + static final String REPOSITORY = "repository"; + static final String STATE = "state"; + static final String INDICES = "indices"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusResponse.java index e5692374fcb..34e503224ce 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusResponse.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.ArrayList; @@ -75,7 +74,7 @@ public class SnapshotsStatusResponse extends ActionResponse implements ToXConten } static final class Fields { - static final XContentBuilderString SNAPSHOTS = new XContentBuilderString("snapshots"); + static final String SNAPSHOTS = "snapshots"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java index f8304bf76a9..b23b6467288 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsIndices.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.cache.query.QueryCacheStats; import org.elasticsearch.index.engine.SegmentsStats; import org.elasticsearch.index.fielddata.FieldDataStats; @@ -165,7 +164,7 @@ public class ClusterStatsIndices implements ToXContent, Streamable { } static final class Fields { - static final XContentBuilderString COUNT = new XContentBuilderString("count"); + static final String COUNT = "count"; } @Override @@ -362,17 +361,17 @@ public class ClusterStatsIndices implements ToXContent, Streamable { } static final class Fields { - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString PRIMARIES = new XContentBuilderString("primaries"); - static final XContentBuilderString REPLICATION = new XContentBuilderString("replication"); - static final XContentBuilderString MIN = new XContentBuilderString("min"); - static final XContentBuilderString MAX = new XContentBuilderString("max"); - static final XContentBuilderString AVG = new XContentBuilderString("avg"); - static final XContentBuilderString INDEX = new XContentBuilderString("index"); + static final String SHARDS = "shards"; + static final String TOTAL = "total"; + static final String PRIMARIES = "primaries"; + static final String REPLICATION = "replication"; + static final String MIN = "min"; + static final String MAX = "max"; + static final String AVG = "avg"; + static final String INDEX = "index"; } - private void addIntMinMax(XContentBuilderString field, int min, int max, double avg, XContentBuilder builder) throws IOException { + private void addIntMinMax(String field, int min, int max, double avg, XContentBuilder builder) throws IOException { builder.startObject(field); builder.field(Fields.MIN, min); builder.field(Fields.MAX, max); @@ -380,7 +379,7 @@ public class ClusterStatsIndices implements ToXContent, Streamable { builder.endObject(); } - private void addDoubleMinMax(XContentBuilderString field, double min, double max, double avg, XContentBuilder builder) throws IOException { + private void addDoubleMinMax(String field, double min, double max, double avg, XContentBuilder builder) throws IOException { builder.startObject(field); builder.field(Fields.MIN, min); builder.field(Fields.MAX, max); diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java index 61ec31b2699..992d3589a90 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsNodes.java @@ -35,7 +35,6 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.monitor.fs.FsInfo; import org.elasticsearch.monitor.jvm.JvmInfo; import org.elasticsearch.plugins.PluginInfo; @@ -163,13 +162,13 @@ public class ClusterStatsNodes implements ToXContent, Writeable<ClusterStatsNode } static final class Fields { - static final XContentBuilderString COUNT = new XContentBuilderString("count"); - static final XContentBuilderString VERSIONS = new XContentBuilderString("versions"); - static final XContentBuilderString OS = new XContentBuilderString("os"); - static final XContentBuilderString PROCESS = new XContentBuilderString("process"); - static final XContentBuilderString JVM = new XContentBuilderString("jvm"); - static final XContentBuilderString FS = new XContentBuilderString("fs"); - static final XContentBuilderString PLUGINS = new XContentBuilderString("plugins"); + static final String COUNT = "count"; + static final String VERSIONS = "versions"; + static final String OS = "os"; + static final String PROCESS = "process"; + static final String JVM = "jvm"; + static final String FS = "fs"; + static final String PLUGINS = "plugins"; } @Override @@ -262,7 +261,7 @@ public class ClusterStatsNodes implements ToXContent, Writeable<ClusterStatsNode } static final class Fields { - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); + static final String TOTAL = "total"; } @Override @@ -332,11 +331,11 @@ public class ClusterStatsNodes implements ToXContent, Writeable<ClusterStatsNode } static final class Fields { - static final XContentBuilderString AVAILABLE_PROCESSORS = new XContentBuilderString("available_processors"); - static final XContentBuilderString ALLOCATED_PROCESSORS = new XContentBuilderString("allocated_processors"); - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString NAMES = new XContentBuilderString("names"); - static final XContentBuilderString COUNT = new XContentBuilderString("count"); + static final String AVAILABLE_PROCESSORS = "available_processors"; + static final String ALLOCATED_PROCESSORS = "allocated_processors"; + static final String NAME = "name"; + static final String NAMES = "names"; + static final String COUNT = "count"; } @Override @@ -444,12 +443,12 @@ public class ClusterStatsNodes implements ToXContent, Writeable<ClusterStatsNode } static final class Fields { - static final XContentBuilderString CPU = new XContentBuilderString("cpu"); - static final XContentBuilderString PERCENT = new XContentBuilderString("percent"); - static final XContentBuilderString OPEN_FILE_DESCRIPTORS = new XContentBuilderString("open_file_descriptors"); - static final XContentBuilderString MIN = new XContentBuilderString("min"); - static final XContentBuilderString MAX = new XContentBuilderString("max"); - static final XContentBuilderString AVG = new XContentBuilderString("avg"); + static final String CPU = "cpu"; + static final String PERCENT = "percent"; + static final String OPEN_FILE_DESCRIPTORS = "open_file_descriptors"; + static final String MIN = "min"; + static final String MAX = "max"; + static final String AVG = "avg"; } @Override @@ -567,20 +566,20 @@ public class ClusterStatsNodes implements ToXContent, Writeable<ClusterStatsNode } static final class Fields { - static final XContentBuilderString VERSIONS = new XContentBuilderString("versions"); - static final XContentBuilderString VERSION = new XContentBuilderString("version"); - static final XContentBuilderString VM_NAME = new XContentBuilderString("vm_name"); - static final XContentBuilderString VM_VERSION = new XContentBuilderString("vm_version"); - static final XContentBuilderString VM_VENDOR = new XContentBuilderString("vm_vendor"); - static final XContentBuilderString COUNT = new XContentBuilderString("count"); - static final XContentBuilderString THREADS = new XContentBuilderString("threads"); - static final XContentBuilderString MAX_UPTIME = new XContentBuilderString("max_uptime"); - static final XContentBuilderString MAX_UPTIME_IN_MILLIS = new XContentBuilderString("max_uptime_in_millis"); - static final XContentBuilderString MEM = new XContentBuilderString("mem"); - static final XContentBuilderString HEAP_USED = new XContentBuilderString("heap_used"); - static final XContentBuilderString HEAP_USED_IN_BYTES = new XContentBuilderString("heap_used_in_bytes"); - static final XContentBuilderString HEAP_MAX = new XContentBuilderString("heap_max"); - static final XContentBuilderString HEAP_MAX_IN_BYTES = new XContentBuilderString("heap_max_in_bytes"); + static final String VERSIONS = "versions"; + static final String VERSION = "version"; + static final String VM_NAME = "vm_name"; + static final String VM_VERSION = "vm_version"; + static final String VM_VENDOR = "vm_vendor"; + static final String COUNT = "count"; + static final String THREADS = "threads"; + static final String MAX_UPTIME = "max_uptime"; + static final String MAX_UPTIME_IN_MILLIS = "max_uptime_in_millis"; + static final String MEM = "mem"; + static final String HEAP_USED = "heap_used"; + static final String HEAP_USED_IN_BYTES = "heap_used_in_bytes"; + static final String HEAP_MAX = "heap_max"; + static final String HEAP_MAX_IN_BYTES = "heap_max_in_bytes"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsResponse.java index b801c43b025..c272e6d6fbe 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/stats/ClusterStatsResponse.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import java.io.IOException; @@ -130,11 +129,11 @@ public class ClusterStatsResponse extends BaseNodesResponse<ClusterStatsNodeResp } static final class Fields { - static final XContentBuilderString NODES = new XContentBuilderString("nodes"); - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); - static final XContentBuilderString UUID = new XContentBuilderString("uuid"); - static final XContentBuilderString CLUSTER_NAME = new XContentBuilderString("cluster_name"); - static final XContentBuilderString STATUS = new XContentBuilderString("status"); + static final String NODES = "nodes"; + static final String INDICES = "indices"; + static final String UUID = "uuid"; + static final String CLUSTER_NAME = "cluster_name"; + static final String STATUS = "status"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksResponse.java index 59700fae57e..35d5b3efb7b 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksResponse.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import java.io.IOException; @@ -103,13 +102,13 @@ public class PendingClusterTasksResponse extends ActionResponse implements Itera static final class Fields { - static final XContentBuilderString TASKS = new XContentBuilderString("tasks"); - static final XContentBuilderString EXECUTING = new XContentBuilderString("executing"); - static final XContentBuilderString INSERT_ORDER = new XContentBuilderString("insert_order"); - static final XContentBuilderString PRIORITY = new XContentBuilderString("priority"); - static final XContentBuilderString SOURCE = new XContentBuilderString("source"); - static final XContentBuilderString TIME_IN_QUEUE_MILLIS = new XContentBuilderString("time_in_queue_millis"); - static final XContentBuilderString TIME_IN_QUEUE = new XContentBuilderString("time_in_queue"); + static final String TASKS = "tasks"; + static final String EXECUTING = "executing"; + static final String INSERT_ORDER = "insert_order"; + static final String PRIORITY = "priority"; + static final String SOURCE = "source"; + static final String TIME_IN_QUEUE_MILLIS = "time_in_queue_millis"; + static final String TIME_IN_QUEUE = "time_in_queue"; } diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeResponse.java b/core/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeResponse.java index f867c2ec1ee..48db340a1c7 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeResponse.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.ArrayList; @@ -204,12 +203,12 @@ public class AnalyzeResponse extends ActionResponse implements Iterable<AnalyzeR } static final class Fields { - static final XContentBuilderString TOKENS = new XContentBuilderString("tokens"); - static final XContentBuilderString TOKEN = new XContentBuilderString("token"); - static final XContentBuilderString START_OFFSET = new XContentBuilderString("start_offset"); - static final XContentBuilderString END_OFFSET = new XContentBuilderString("end_offset"); - static final XContentBuilderString TYPE = new XContentBuilderString("type"); - static final XContentBuilderString POSITION = new XContentBuilderString("position"); - static final XContentBuilderString DETAIL = new XContentBuilderString("detail"); + static final String TOKENS = "tokens"; + static final String TOKEN = "token"; + static final String START_OFFSET = "start_offset"; + static final String END_OFFSET = "end_offset"; + static final String TYPE = "type"; + static final String POSITION = "position"; + static final String DETAIL = "detail"; } } diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/analyze/DetailAnalyzeResponse.java b/core/src/main/java/org/elasticsearch/action/admin/indices/analyze/DetailAnalyzeResponse.java index 08d18ffd1db..c67c0360230 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/analyze/DetailAnalyzeResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/analyze/DetailAnalyzeResponse.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -132,13 +131,13 @@ public class DetailAnalyzeResponse implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString FILTERED_TEXT = new XContentBuilderString("filtered_text"); - static final XContentBuilderString CUSTOM_ANALYZER = new XContentBuilderString("custom_analyzer"); - static final XContentBuilderString ANALYZER = new XContentBuilderString("analyzer"); - static final XContentBuilderString CHARFILTERS = new XContentBuilderString("charfilters"); - static final XContentBuilderString TOKENIZER = new XContentBuilderString("tokenizer"); - static final XContentBuilderString TOKENFILTERS = new XContentBuilderString("tokenfilters"); + static final String NAME = "name"; + static final String FILTERED_TEXT = "filtered_text"; + static final String CUSTOM_ANALYZER = "custom_analyzer"; + static final String ANALYZER = "analyzer"; + static final String CHARFILTERS = "charfilters"; + static final String TOKENIZER = "tokenizer"; + static final String TOKENFILTERS = "tokenfilters"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/flush/SyncedFlushResponse.java b/core/src/main/java/org/elasticsearch/action/admin/indices/flush/SyncedFlushResponse.java index 5925370e5f7..b2998d07e07 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/flush/SyncedFlushResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/flush/SyncedFlushResponse.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.util.iterable.Iterables; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.indices.flush.ShardsSyncedFlushResult; import org.elasticsearch.indices.flush.SyncedFlushService; import org.elasticsearch.rest.RestStatus; @@ -181,14 +180,14 @@ public class SyncedFlushResponse extends ActionResponse implements ToXContent { } static final class Fields { - static final XContentBuilderString _SHARDS = new XContentBuilderString("_shards"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString SUCCESSFUL = new XContentBuilderString("successful"); - static final XContentBuilderString FAILED = new XContentBuilderString("failed"); - static final XContentBuilderString FAILURES = new XContentBuilderString("failures"); - static final XContentBuilderString SHARD = new XContentBuilderString("shard"); - static final XContentBuilderString ROUTING = new XContentBuilderString("routing"); - static final XContentBuilderString REASON = new XContentBuilderString("reason"); + static final String _SHARDS = "_shards"; + static final String TOTAL = "total"; + static final String SUCCESSFUL = "successful"; + static final String FAILED = "failed"; + static final String FAILURES = "failures"; + static final String SHARD = "shard"; + static final String ROUTING = "routing"; + static final String REASON = "reason"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentResponse.java b/core/src/main/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentResponse.java index 05729f4f0f9..ed9463d1544 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/segments/IndicesSegmentResponse.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.engine.Segment; import java.io.IOException; @@ -181,31 +180,31 @@ public class IndicesSegmentResponse extends BroadcastResponse implements ToXCont } static final class Fields { - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); - static final XContentBuilderString ROUTING = new XContentBuilderString("routing"); - static final XContentBuilderString STATE = new XContentBuilderString("state"); - static final XContentBuilderString PRIMARY = new XContentBuilderString("primary"); - static final XContentBuilderString NODE = new XContentBuilderString("node"); - static final XContentBuilderString RELOCATING_NODE = new XContentBuilderString("relocating_node"); + static final String INDICES = "indices"; + static final String SHARDS = "shards"; + static final String ROUTING = "routing"; + static final String STATE = "state"; + static final String PRIMARY = "primary"; + static final String NODE = "node"; + static final String RELOCATING_NODE = "relocating_node"; - static final XContentBuilderString SEGMENTS = new XContentBuilderString("segments"); - static final XContentBuilderString GENERATION = new XContentBuilderString("generation"); - static final XContentBuilderString NUM_COMMITTED_SEGMENTS = new XContentBuilderString("num_committed_segments"); - static final XContentBuilderString NUM_SEARCH_SEGMENTS = new XContentBuilderString("num_search_segments"); - static final XContentBuilderString NUM_DOCS = new XContentBuilderString("num_docs"); - static final XContentBuilderString DELETED_DOCS = new XContentBuilderString("deleted_docs"); - static final XContentBuilderString SIZE = new XContentBuilderString("size"); - static final XContentBuilderString SIZE_IN_BYTES = new XContentBuilderString("size_in_bytes"); - static final XContentBuilderString COMMITTED = new XContentBuilderString("committed"); - static final XContentBuilderString SEARCH = new XContentBuilderString("search"); - static final XContentBuilderString VERSION = new XContentBuilderString("version"); - static final XContentBuilderString COMPOUND = new XContentBuilderString("compound"); - static final XContentBuilderString MERGE_ID = new XContentBuilderString("merge_id"); - static final XContentBuilderString MEMORY = new XContentBuilderString("memory"); - static final XContentBuilderString MEMORY_IN_BYTES = new XContentBuilderString("memory_in_bytes"); - static final XContentBuilderString RAM_TREE = new XContentBuilderString("ram_tree"); - static final XContentBuilderString DESCRIPTION = new XContentBuilderString("description"); - static final XContentBuilderString CHILDREN = new XContentBuilderString("children"); + static final String SEGMENTS = "segments"; + static final String GENERATION = "generation"; + static final String NUM_COMMITTED_SEGMENTS = "num_committed_segments"; + static final String NUM_SEARCH_SEGMENTS = "num_search_segments"; + static final String NUM_DOCS = "num_docs"; + static final String DELETED_DOCS = "deleted_docs"; + static final String SIZE = "size"; + static final String SIZE_IN_BYTES = "size_in_bytes"; + static final String COMMITTED = "committed"; + static final String SEARCH = "search"; + static final String VERSION = "version"; + static final String COMPOUND = "compound"; + static final String MERGE_ID = "merge_id"; + static final String MEMORY = "memory"; + static final String MEMORY_IN_BYTES = "memory_in_bytes"; + static final String RAM_TREE = "ram_tree"; + static final String DESCRIPTION = "description"; + static final String CHILDREN = "children"; } } diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java b/core/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java index de92430efe6..ec53ee69692 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java @@ -33,7 +33,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.shard.ShardStateMetaData; import java.io.IOException; @@ -401,14 +400,14 @@ public class IndicesShardStoresResponse extends ActionResponse implements ToXCon } static final class Fields { - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); - static final XContentBuilderString FAILURES = new XContentBuilderString("failures"); - static final XContentBuilderString STORES = new XContentBuilderString("stores"); + static final String INDICES = "indices"; + static final String SHARDS = "shards"; + static final String FAILURES = "failures"; + static final String STORES = "stores"; // StoreStatus fields - static final XContentBuilderString LEGACY_VERSION = new XContentBuilderString("legacy_version"); - static final XContentBuilderString ALLOCATION_ID = new XContentBuilderString("allocation_id"); - static final XContentBuilderString STORE_EXCEPTION = new XContentBuilderString("store_exception"); - static final XContentBuilderString ALLOCATED = new XContentBuilderString("allocation"); + static final String LEGACY_VERSION = "legacy_version"; + static final String ALLOCATION_ID = "allocation_id"; + static final String STORE_EXCEPTION = "store_exception"; + static final String ALLOCATED = "allocation"; } } diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java b/core/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java index a99a8883ddc..2caa0da9569 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/stats/IndicesStatsResponse.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import java.io.IOException; @@ -208,8 +207,8 @@ public class IndicesStatsResponse extends BroadcastResponse implements ToXConten } static final class Fields { - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); + static final String INDICES = "indices"; + static final String SHARDS = "shards"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/stats/ShardStats.java b/core/src/main/java/org/elasticsearch/action/admin/indices/stats/ShardStats.java index 045fcc0c1e2..50b3157bfab 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/stats/ShardStats.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/stats/ShardStats.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.engine.CommitStats; import org.elasticsearch.index.shard.ShardPath; @@ -132,14 +131,14 @@ public class ShardStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString ROUTING = new XContentBuilderString("routing"); - static final XContentBuilderString STATE = new XContentBuilderString("state"); - static final XContentBuilderString STATE_PATH = new XContentBuilderString("state_path"); - static final XContentBuilderString DATA_PATH = new XContentBuilderString("data_path"); - static final XContentBuilderString IS_CUSTOM_DATA_PATH = new XContentBuilderString("is_custom_data_path"); - static final XContentBuilderString SHARD_PATH = new XContentBuilderString("shard_path"); - static final XContentBuilderString PRIMARY = new XContentBuilderString("primary"); - static final XContentBuilderString NODE = new XContentBuilderString("node"); - static final XContentBuilderString RELOCATING_NODE = new XContentBuilderString("relocating_node"); + static final String ROUTING = "routing"; + static final String STATE = "state"; + static final String STATE_PATH = "state_path"; + static final String DATA_PATH = "data_path"; + static final String IS_CUSTOM_DATA_PATH = "is_custom_data_path"; + static final String SHARD_PATH = "shard_path"; + static final String PRIMARY = "primary"; + static final String NODE = "node"; + static final String RELOCATING_NODE = "relocating_node"; } } diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/get/UpgradeStatusResponse.java b/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/get/UpgradeStatusResponse.java index b20f8554500..6b1d02b6a4b 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/get/UpgradeStatusResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/upgrade/get/UpgradeStatusResponse.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.ArrayList; @@ -165,18 +164,18 @@ public class UpgradeStatusResponse extends BroadcastResponse implements ToXConte } static final class Fields { - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); - static final XContentBuilderString ROUTING = new XContentBuilderString("routing"); - static final XContentBuilderString STATE = new XContentBuilderString("state"); - static final XContentBuilderString PRIMARY = new XContentBuilderString("primary"); - static final XContentBuilderString NODE = new XContentBuilderString("node"); - static final XContentBuilderString RELOCATING_NODE = new XContentBuilderString("relocating_node"); - static final XContentBuilderString SIZE = new XContentBuilderString("size"); - static final XContentBuilderString SIZE_IN_BYTES = new XContentBuilderString("size_in_bytes"); - static final XContentBuilderString SIZE_TO_UPGRADE = new XContentBuilderString("size_to_upgrade"); - static final XContentBuilderString SIZE_TO_UPGRADE_ANCIENT = new XContentBuilderString("size_to_upgrade_ancient"); - static final XContentBuilderString SIZE_TO_UPGRADE_IN_BYTES = new XContentBuilderString("size_to_upgrade_in_bytes"); - static final XContentBuilderString SIZE_TO_UPGRADE_ANCIENT_IN_BYTES = new XContentBuilderString("size_to_upgrade_ancient_in_bytes"); + static final String INDICES = "indices"; + static final String SHARDS = "shards"; + static final String ROUTING = "routing"; + static final String STATE = "state"; + static final String PRIMARY = "primary"; + static final String NODE = "node"; + static final String RELOCATING_NODE = "relocating_node"; + static final String SIZE = "size"; + static final String SIZE_IN_BYTES = "size_in_bytes"; + static final String SIZE_TO_UPGRADE = "size_to_upgrade"; + static final String SIZE_TO_UPGRADE_ANCIENT = "size_to_upgrade_ancient"; + static final String SIZE_TO_UPGRADE_IN_BYTES = "size_to_upgrade_in_bytes"; + static final String SIZE_TO_UPGRADE_ANCIENT_IN_BYTES = "size_to_upgrade_ancient_in_bytes"; } } diff --git a/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java b/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java index b7d4ba72c55..13d4201e6cf 100644 --- a/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java +++ b/core/src/main/java/org/elasticsearch/action/bulk/BulkItemResponse.java @@ -32,7 +32,6 @@ import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.StatusToXContent; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.RestStatus; import java.io.IOException; @@ -68,11 +67,11 @@ public class BulkItemResponse implements Streamable, StatusToXContent { } static final class Fields { - static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - static final XContentBuilderString _TYPE = new XContentBuilderString("_type"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); - static final XContentBuilderString STATUS = new XContentBuilderString("status"); - static final XContentBuilderString ERROR = new XContentBuilderString("error"); + static final String _INDEX = "_index"; + static final String _TYPE = "_type"; + static final String _ID = "_id"; + static final String STATUS = "status"; + static final String ERROR = "error"; } /** diff --git a/core/src/main/java/org/elasticsearch/action/delete/DeleteResponse.java b/core/src/main/java/org/elasticsearch/action/delete/DeleteResponse.java index 57781547266..f40c419b7ff 100644 --- a/core/src/main/java/org/elasticsearch/action/delete/DeleteResponse.java +++ b/core/src/main/java/org/elasticsearch/action/delete/DeleteResponse.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.DocWriteResponse; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.rest.RestStatus; @@ -77,7 +76,7 @@ public class DeleteResponse extends DocWriteResponse { } static final class Fields { - static final XContentBuilderString FOUND = new XContentBuilderString("found"); + static final String FOUND = "found"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/fieldstats/FieldStats.java b/core/src/main/java/org/elasticsearch/action/fieldstats/FieldStats.java index e842d412642..a225d7b7e51 100644 --- a/core/src/main/java/org/elasticsearch/action/fieldstats/FieldStats.java +++ b/core/src/main/java/org/elasticsearch/action/fieldstats/FieldStats.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.joda.Joda; import org.elasticsearch.common.network.NetworkAddress; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.net.InetAddress; @@ -561,15 +560,15 @@ public abstract class FieldStats<T> implements Streamable, ToXContent { private final static class Fields { - final static XContentBuilderString MAX_DOC = new XContentBuilderString("max_doc"); - final static XContentBuilderString DOC_COUNT = new XContentBuilderString("doc_count"); - final static XContentBuilderString DENSITY = new XContentBuilderString("density"); - final static XContentBuilderString SUM_DOC_FREQ = new XContentBuilderString("sum_doc_freq"); - final static XContentBuilderString SUM_TOTAL_TERM_FREQ = new XContentBuilderString("sum_total_term_freq"); - final static XContentBuilderString MIN_VALUE = new XContentBuilderString("min_value"); - final static XContentBuilderString MIN_VALUE_AS_STRING = new XContentBuilderString("min_value_as_string"); - final static XContentBuilderString MAX_VALUE = new XContentBuilderString("max_value"); - final static XContentBuilderString MAX_VALUE_AS_STRING = new XContentBuilderString("max_value_as_string"); + final static String MAX_DOC = new String("max_doc"); + final static String DOC_COUNT = new String("doc_count"); + final static String DENSITY = new String("density"); + final static String SUM_DOC_FREQ = new String("sum_doc_freq"); + final static String SUM_TOTAL_TERM_FREQ = new String("sum_total_term_freq"); + final static String MIN_VALUE = new String("min_value"); + final static String MIN_VALUE_AS_STRING = new String("min_value_as_string"); + final static String MAX_VALUE = new String("max_value"); + final static String MAX_VALUE_AS_STRING = new String("max_value_as_string"); } diff --git a/core/src/main/java/org/elasticsearch/action/get/MultiGetResponse.java b/core/src/main/java/org/elasticsearch/action/get/MultiGetResponse.java index 32e10b82de2..891f1cf6597 100644 --- a/core/src/main/java/org/elasticsearch/action/get/MultiGetResponse.java +++ b/core/src/main/java/org/elasticsearch/action/get/MultiGetResponse.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Arrays; @@ -151,12 +150,12 @@ public class MultiGetResponse extends ActionResponse implements Iterable<MultiGe } static final class Fields { - static final XContentBuilderString DOCS = new XContentBuilderString("docs"); - static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - static final XContentBuilderString _TYPE = new XContentBuilderString("_type"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); - static final XContentBuilderString ERROR = new XContentBuilderString("error"); - static final XContentBuilderString ROOT_CAUSE = new XContentBuilderString("root_cause"); + static final String DOCS = "docs"; + static final String _INDEX = "_index"; + static final String _TYPE = "_type"; + static final String _ID = "_id"; + static final String ERROR = "error"; + static final String ROOT_CAUSE = "root_cause"; } @@ -177,4 +176,4 @@ public class MultiGetResponse extends ActionResponse implements Iterable<MultiGe response.writeTo(out); } } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/elasticsearch/action/index/IndexResponse.java b/core/src/main/java/org/elasticsearch/action/index/IndexResponse.java index 665327a749f..b37e86ccb2c 100644 --- a/core/src/main/java/org/elasticsearch/action/index/IndexResponse.java +++ b/core/src/main/java/org/elasticsearch/action/index/IndexResponse.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.DocWriteResponse; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.rest.RestStatus; @@ -89,7 +88,7 @@ public class IndexResponse extends DocWriteResponse { } static final class Fields { - static final XContentBuilderString CREATED = new XContentBuilderString("created"); + static final String CREATED = "created"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineResponse.java b/core/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineResponse.java index 92f9aad8fec..ad2da3e57b8 100644 --- a/core/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineResponse.java +++ b/core/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineResponse.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.ArrayList; @@ -98,6 +97,6 @@ public class SimulatePipelineResponse extends ActionResponse implements ToXConte } static final class Fields { - static final XContentBuilderString DOCUMENTS = new XContentBuilderString("docs"); + static final String DOCUMENTS = "docs"; } } diff --git a/core/src/main/java/org/elasticsearch/action/percolate/MultiPercolateResponse.java b/core/src/main/java/org/elasticsearch/action/percolate/MultiPercolateResponse.java index 812d525bce2..3c626678e74 100644 --- a/core/src/main/java/org/elasticsearch/action/percolate/MultiPercolateResponse.java +++ b/core/src/main/java/org/elasticsearch/action/percolate/MultiPercolateResponse.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Arrays; @@ -176,8 +175,8 @@ public class MultiPercolateResponse extends ActionResponse implements Iterable<M } static final class Fields { - static final XContentBuilderString RESPONSES = new XContentBuilderString("responses"); - static final XContentBuilderString ERROR = new XContentBuilderString("error"); + static final String RESPONSES = "responses"; + static final String ERROR = "error"; } } diff --git a/core/src/main/java/org/elasticsearch/action/percolate/PercolateResponse.java b/core/src/main/java/org/elasticsearch/action/percolate/PercolateResponse.java index 9400cece8b6..1ebf1cad3ec 100644 --- a/core/src/main/java/org/elasticsearch/action/percolate/PercolateResponse.java +++ b/core/src/main/java/org/elasticsearch/action/percolate/PercolateResponse.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.text.Text; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.action.support.RestActions; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.highlight.HighlightField; @@ -285,13 +284,13 @@ public class PercolateResponse extends BroadcastResponse implements Iterable<Per } static final class Fields { - static final XContentBuilderString TOOK = new XContentBuilderString("took"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString MATCHES = new XContentBuilderString("matches"); - static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); - static final XContentBuilderString _SCORE = new XContentBuilderString("_score"); - static final XContentBuilderString HIGHLIGHT = new XContentBuilderString("highlight"); + static final String TOOK = "took"; + static final String TOTAL = "total"; + static final String MATCHES = "matches"; + static final String _INDEX = "_index"; + static final String _ID = "_id"; + static final String _SCORE = "_score"; + static final String HIGHLIGHT = "highlight"; } } diff --git a/core/src/main/java/org/elasticsearch/action/search/ClearScrollResponse.java b/core/src/main/java/org/elasticsearch/action/search/ClearScrollResponse.java index 2b3cd804fcc..0887d268199 100644 --- a/core/src/main/java/org/elasticsearch/action/search/ClearScrollResponse.java +++ b/core/src/main/java/org/elasticsearch/action/search/ClearScrollResponse.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.StatusToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.RestStatus; import java.io.IOException; @@ -89,8 +88,8 @@ public class ClearScrollResponse extends ActionResponse implements StatusToXCont } static final class Fields { - static final XContentBuilderString SUCCEEDED = new XContentBuilderString("succeeded"); - static final XContentBuilderString NUMFREED = new XContentBuilderString("num_freed"); + static final String SUCCEEDED = "succeeded"; + static final String NUMFREED = "num_freed"; } } diff --git a/core/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java b/core/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java index 0a9d6191030..bc1e697646f 100644 --- a/core/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java +++ b/core/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import java.io.IOException; @@ -166,11 +165,11 @@ public class MultiSearchResponse extends ActionResponse implements Iterable<Mult } static final class Fields { - static final XContentBuilderString RESPONSES = new XContentBuilderString("responses"); - static final XContentBuilderString ERROR = new XContentBuilderString("error"); - static final XContentBuilderString ROOT_CAUSE = new XContentBuilderString("root_cause"); + static final String RESPONSES = "responses"; + static final String ERROR = "error"; + static final String ROOT_CAUSE = "root_cause"; } - + @Override public String toString() { try { diff --git a/core/src/main/java/org/elasticsearch/action/search/SearchResponse.java b/core/src/main/java/org/elasticsearch/action/search/SearchResponse.java index e6681bf2b9f..be61301bbd6 100644 --- a/core/src/main/java/org/elasticsearch/action/search/SearchResponse.java +++ b/core/src/main/java/org/elasticsearch/action/search/SearchResponse.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.StatusToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.support.RestActions; @@ -175,10 +174,10 @@ public class SearchResponse extends ActionResponse implements StatusToXContent { } static final class Fields { - static final XContentBuilderString _SCROLL_ID = new XContentBuilderString("_scroll_id"); - static final XContentBuilderString TOOK = new XContentBuilderString("took"); - static final XContentBuilderString TIMED_OUT = new XContentBuilderString("timed_out"); - static final XContentBuilderString TERMINATED_EARLY = new XContentBuilderString("terminated_early"); + static final String _SCROLL_ID = "_scroll_id"; + static final String TOOK = "took"; + static final String TIMED_OUT = "timed_out"; + static final String TERMINATED_EARLY = "terminated_early"; } @Override diff --git a/core/src/main/java/org/elasticsearch/action/termvectors/MultiTermVectorsResponse.java b/core/src/main/java/org/elasticsearch/action/termvectors/MultiTermVectorsResponse.java index 6eb3b3277e6..8e442538d77 100644 --- a/core/src/main/java/org/elasticsearch/action/termvectors/MultiTermVectorsResponse.java +++ b/core/src/main/java/org/elasticsearch/action/termvectors/MultiTermVectorsResponse.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Arrays; @@ -147,10 +146,10 @@ public class MultiTermVectorsResponse extends ActionResponse implements Iterable } static final class Fields { - static final XContentBuilderString DOCS = new XContentBuilderString("docs"); - static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - static final XContentBuilderString _TYPE = new XContentBuilderString("_type"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); + static final String DOCS = "docs"; + static final String _INDEX = "_index"; + static final String _TYPE = "_type"; + static final String _ID = "_id"; } @Override @@ -170,4 +169,4 @@ public class MultiTermVectorsResponse extends ActionResponse implements Iterable response.writeTo(out); } } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsResponse.java b/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsResponse.java index 2a4bc836ece..70df1261f49 100644 --- a/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsResponse.java +++ b/core/src/main/java/org/elasticsearch/action/termvectors/TermVectorsResponse.java @@ -38,7 +38,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.search.dfs.AggregatedDfs; import java.io.IOException; @@ -51,30 +50,30 @@ public class TermVectorsResponse extends ActionResponse implements ToXContent { private static class FieldStrings { // term statistics strings - public static final XContentBuilderString TTF = new XContentBuilderString("ttf"); - public static final XContentBuilderString DOC_FREQ = new XContentBuilderString("doc_freq"); - public static final XContentBuilderString TERM_FREQ = new XContentBuilderString("term_freq"); - public static final XContentBuilderString SCORE = new XContentBuilderString("score"); + public static final String TTF = "ttf"; + public static final String DOC_FREQ = "doc_freq"; + public static final String TERM_FREQ = "term_freq"; + public static final String SCORE = "score"; // field statistics strings - public static final XContentBuilderString FIELD_STATISTICS = new XContentBuilderString("field_statistics"); - public static final XContentBuilderString DOC_COUNT = new XContentBuilderString("doc_count"); - public static final XContentBuilderString SUM_DOC_FREQ = new XContentBuilderString("sum_doc_freq"); - public static final XContentBuilderString SUM_TTF = new XContentBuilderString("sum_ttf"); + public static final String FIELD_STATISTICS = "field_statistics"; + public static final String DOC_COUNT = "doc_count"; + public static final String SUM_DOC_FREQ = "sum_doc_freq"; + public static final String SUM_TTF = "sum_ttf"; - public static final XContentBuilderString TOKENS = new XContentBuilderString("tokens"); - public static final XContentBuilderString POS = new XContentBuilderString("position"); - public static final XContentBuilderString START_OFFSET = new XContentBuilderString("start_offset"); - public static final XContentBuilderString END_OFFSET = new XContentBuilderString("end_offset"); - public static final XContentBuilderString PAYLOAD = new XContentBuilderString("payload"); - public static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - public static final XContentBuilderString _TYPE = new XContentBuilderString("_type"); - public static final XContentBuilderString _ID = new XContentBuilderString("_id"); - public static final XContentBuilderString _VERSION = new XContentBuilderString("_version"); - public static final XContentBuilderString FOUND = new XContentBuilderString("found"); - public static final XContentBuilderString TOOK = new XContentBuilderString("took"); - public static final XContentBuilderString TERMS = new XContentBuilderString("terms"); - public static final XContentBuilderString TERM_VECTORS = new XContentBuilderString("term_vectors"); + public static final String TOKENS = "tokens"; + public static final String POS = "position"; + public static final String START_OFFSET = "start_offset"; + public static final String END_OFFSET = "end_offset"; + public static final String PAYLOAD = "payload"; + public static final String _INDEX = "_index"; + public static final String _TYPE = "_type"; + public static final String _ID = "_id"; + public static final String _VERSION = "_version"; + public static final String FOUND = "found"; + public static final String TOOK = "took"; + public static final String TERMS = "terms"; + public static final String TERM_VECTORS = "term_vectors"; } private BytesReference termVectors; @@ -337,7 +336,7 @@ public class TermVectorsResponse extends ActionResponse implements ToXContent { public long getTookInMillis() { return tookInMillis; } - + private void buildScore(XContentBuilder builder, BoostAttribute boostAtt) throws IOException { if (hasScores) { builder.field(FieldStrings.SCORE, boostAtt.getBoost()); @@ -347,7 +346,7 @@ public class TermVectorsResponse extends ActionResponse implements ToXContent { public boolean isExists() { return exists; } - + public void setExists(boolean exists) { this.exists = exists; } diff --git a/core/src/main/java/org/elasticsearch/action/update/UpdateResponse.java b/core/src/main/java/org/elasticsearch/action/update/UpdateResponse.java index 2f3146b0644..8d2eeeb383b 100644 --- a/core/src/main/java/org/elasticsearch/action/update/UpdateResponse.java +++ b/core/src/main/java/org/elasticsearch/action/update/UpdateResponse.java @@ -23,7 +23,6 @@ import org.elasticsearch.action.DocWriteResponse; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.get.GetResult; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.rest.RestStatus; @@ -101,7 +100,7 @@ public class UpdateResponse extends DocWriteResponse { static final class Fields { - static final XContentBuilderString GET = new XContentBuilderString("get"); + static final String GET = "get"; } @Override diff --git a/core/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java b/core/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java index c90edee0d50..5432c1f0f19 100644 --- a/core/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java +++ b/core/src/main/java/org/elasticsearch/cluster/SnapshotsInProgress.java @@ -29,7 +29,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.shard.ShardId; import java.io.IOException; @@ -412,19 +411,19 @@ public class SnapshotsInProgress extends AbstractDiffable<Custom> implements Cus } static final class Fields { - static final XContentBuilderString REPOSITORY = new XContentBuilderString("repository"); - static final XContentBuilderString SNAPSHOTS = new XContentBuilderString("snapshots"); - static final XContentBuilderString SNAPSHOT = new XContentBuilderString("snapshot"); - static final XContentBuilderString INCLUDE_GLOBAL_STATE = new XContentBuilderString("include_global_state"); - static final XContentBuilderString PARTIAL = new XContentBuilderString("partial"); - static final XContentBuilderString STATE = new XContentBuilderString("state"); - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); - static final XContentBuilderString START_TIME_MILLIS = new XContentBuilderString("start_time_millis"); - static final XContentBuilderString START_TIME = new XContentBuilderString("start_time"); - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); - static final XContentBuilderString INDEX = new XContentBuilderString("index"); - static final XContentBuilderString SHARD = new XContentBuilderString("shard"); - static final XContentBuilderString NODE = new XContentBuilderString("node"); + static final String REPOSITORY = "repository"; + static final String SNAPSHOTS = "snapshots"; + static final String SNAPSHOT = "snapshot"; + static final String INCLUDE_GLOBAL_STATE = "include_global_state"; + static final String PARTIAL = "partial"; + static final String STATE = "state"; + static final String INDICES = "indices"; + static final String START_TIME_MILLIS = "start_time_millis"; + static final String START_TIME = "start_time"; + static final String SHARDS = "shards"; + static final String INDEX = "index"; + static final String SHARD = "shard"; + static final String NODE = "node"; } @Override diff --git a/core/src/main/java/org/elasticsearch/cluster/health/ClusterIndexHealth.java b/core/src/main/java/org/elasticsearch/cluster/health/ClusterIndexHealth.java index ce1f3adb539..c511eb71f82 100644 --- a/core/src/main/java/org/elasticsearch/cluster/health/ClusterIndexHealth.java +++ b/core/src/main/java/org/elasticsearch/cluster/health/ClusterIndexHealth.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Arrays; @@ -202,17 +201,17 @@ public final class ClusterIndexHealth implements Iterable<ClusterShardHealth>, S } static final class Fields { - static final XContentBuilderString STATUS = new XContentBuilderString("status"); - static final XContentBuilderString NUMBER_OF_SHARDS = new XContentBuilderString("number_of_shards"); - static final XContentBuilderString NUMBER_OF_REPLICAS = new XContentBuilderString("number_of_replicas"); - static final XContentBuilderString ACTIVE_PRIMARY_SHARDS = new XContentBuilderString("active_primary_shards"); - static final XContentBuilderString ACTIVE_SHARDS = new XContentBuilderString("active_shards"); - static final XContentBuilderString RELOCATING_SHARDS = new XContentBuilderString("relocating_shards"); - static final XContentBuilderString INITIALIZING_SHARDS = new XContentBuilderString("initializing_shards"); - static final XContentBuilderString UNASSIGNED_SHARDS = new XContentBuilderString("unassigned_shards"); - static final XContentBuilderString VALIDATION_FAILURES = new XContentBuilderString("validation_failures"); - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); - static final XContentBuilderString PRIMARY_ACTIVE = new XContentBuilderString("primary_active"); + static final String STATUS = "status"; + static final String NUMBER_OF_SHARDS = "number_of_shards"; + static final String NUMBER_OF_REPLICAS = "number_of_replicas"; + static final String ACTIVE_PRIMARY_SHARDS = "active_primary_shards"; + static final String ACTIVE_SHARDS = "active_shards"; + static final String RELOCATING_SHARDS = "relocating_shards"; + static final String INITIALIZING_SHARDS = "initializing_shards"; + static final String UNASSIGNED_SHARDS = "unassigned_shards"; + static final String VALIDATION_FAILURES = "validation_failures"; + static final String SHARDS = "shards"; + static final String PRIMARY_ACTIVE = "primary_active"; } @Override diff --git a/core/src/main/java/org/elasticsearch/common/unit/Fuzziness.java b/core/src/main/java/org/elasticsearch/common/unit/Fuzziness.java index 139dfd75494..afe37e221a0 100644 --- a/core/src/main/java/org/elasticsearch/common/unit/Fuzziness.java +++ b/core/src/main/java/org/elasticsearch/common/unit/Fuzziness.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentParser; import java.io.IOException; @@ -38,12 +37,12 @@ import java.util.Objects; */ public final class Fuzziness implements ToXContent, Writeable<Fuzziness> { - public static final XContentBuilderString X_FIELD_NAME = new XContentBuilderString("fuzziness"); + public static final String X_FIELD_NAME = "fuzziness"; public static final Fuzziness ZERO = new Fuzziness(0); public static final Fuzziness ONE = new Fuzziness(1); public static final Fuzziness TWO = new Fuzziness(2); public static final Fuzziness AUTO = new Fuzziness("AUTO"); - public static final ParseField FIELD = new ParseField(X_FIELD_NAME.value()); + public static final ParseField FIELD = new ParseField(X_FIELD_NAME); private final String fuzziness; diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java b/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java index 83122646df6..4367b15fd52 100644 --- a/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java +++ b/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilder.java @@ -19,22 +19,6 @@ package org.elasticsearch.common.xcontent; -import org.apache.lucene.util.BytesRef; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.bytes.BytesArray; -import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.geo.GeoPoint; -import org.elasticsearch.common.io.BytesStream; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.lease.Releasable; -import org.elasticsearch.common.text.Text; -import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.common.unit.TimeValue; -import org.joda.time.DateTimeZone; -import org.joda.time.ReadableInstant; -import org.joda.time.format.DateTimeFormatter; -import org.joda.time.format.ISODateTimeFormat; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -50,6 +34,21 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.TimeUnit; +import org.apache.lucene.util.BytesRef; +import org.elasticsearch.common.bytes.BytesArray; +import org.elasticsearch.common.bytes.BytesReference; +import org.elasticsearch.common.geo.GeoPoint; +import org.elasticsearch.common.io.BytesStream; +import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.lease.Releasable; +import org.elasticsearch.common.text.Text; +import org.elasticsearch.common.unit.ByteSizeValue; +import org.elasticsearch.common.unit.TimeValue; +import org.joda.time.DateTimeZone; +import org.joda.time.ReadableInstant; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.ISODateTimeFormat; + /** * A utility to build XContent (ie json). */ @@ -146,12 +145,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder startObject(XContentBuilderString name) throws IOException { - field(name); - startObject(); - return this; - } - public XContentBuilder startObject() throws IOException { generator.writeStartObject(); return this; @@ -171,15 +164,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder array(XContentBuilderString name, String... values) throws IOException { - startArray(name); - for (String value : values) { - value(value); - } - endArray(); - return this; - } - public XContentBuilder array(String name, Object... values) throws IOException { startArray(name); for (Object value : values) { @@ -189,27 +173,12 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder array(XContentBuilderString name, Object... values) throws IOException { - startArray(name); - for (Object value : values) { - value(value); - } - endArray(); - return this; - } - public XContentBuilder startArray(String name) throws IOException { field(name); startArray(); return this; } - public XContentBuilder startArray(XContentBuilderString name) throws IOException { - field(name); - startArray(); - return this; - } - public XContentBuilder startArray() throws IOException { generator.writeStartArray(); return this; @@ -220,10 +189,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name) throws IOException { - return field(name.value()); - } - public XContentBuilder field(String name) throws IOException { if (name == null) { throw new IllegalArgumentException("field name cannot be null"); @@ -242,16 +207,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, char[] value, int offset, int length) throws IOException { - field(name); - if (value == null) { - generator.writeNull(); - } else { - generator.writeString(value, offset, length); - } - return this; - } - public XContentBuilder field(String name, String value) throws IOException { field(name); if (value == null) { @@ -262,16 +217,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, String value) throws IOException { - field(name); - if (value == null) { - generator.writeNull(); - } else { - generator.writeString(value); - } - return this; - } - public XContentBuilder field(String name, Integer value) throws IOException { field(name); if (value == null) { @@ -282,28 +227,12 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, Integer value) throws IOException { - field(name); - if (value == null) { - generator.writeNull(); - } else { - generator.writeNumber(value.intValue()); - } - return this; - } - public XContentBuilder field(String name, int value) throws IOException { field(name); generator.writeNumber(value); return this; } - public XContentBuilder field(XContentBuilderString name, int value) throws IOException { - field(name); - generator.writeNumber(value); - return this; - } - public XContentBuilder field(String name, Long value) throws IOException { field(name); if (value == null) { @@ -314,28 +243,12 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, Long value) throws IOException { - field(name); - if (value == null) { - generator.writeNull(); - } else { - generator.writeNumber(value.longValue()); - } - return this; - } - public XContentBuilder field(String name, long value) throws IOException { field(name); generator.writeNumber(value); return this; } - public XContentBuilder field(XContentBuilderString name, long value) throws IOException { - field(name); - generator.writeNumber(value); - return this; - } - public XContentBuilder field(String name, Float value) throws IOException { field(name); if (value == null) { @@ -346,28 +259,12 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, Float value) throws IOException { - field(name); - if (value == null) { - generator.writeNull(); - } else { - generator.writeNumber(value.floatValue()); - } - return this; - } - public XContentBuilder field(String name, float value) throws IOException { field(name); generator.writeNumber(value); return this; } - public XContentBuilder field(XContentBuilderString name, float value) throws IOException { - field(name); - generator.writeNumber(value); - return this; - } - public XContentBuilder field(String name, Double value) throws IOException { field(name); if (value == null) { @@ -378,36 +275,16 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, Double value) throws IOException { - field(name); - if (value == null) { - generator.writeNull(); - } else { - generator.writeNumber(value); - } - return this; - } - public XContentBuilder field(String name, double value) throws IOException { field(name); generator.writeNumber(value); return this; } - public XContentBuilder field(XContentBuilderString name, double value) throws IOException { - field(name); - generator.writeNumber(value); - return this; - } - public XContentBuilder field(String name, BigDecimal value) throws IOException { return field(name, value, value.scale(), RoundingMode.HALF_UP, true); } - public XContentBuilder field(XContentBuilderString name, BigDecimal value) throws IOException { - return field(name, value, value.scale(), RoundingMode.HALF_UP, true); - } - public XContentBuilder field(String name, BigDecimal value, int scale, RoundingMode rounding, boolean toDouble) throws IOException { field(name); if (value == null) { @@ -426,24 +303,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, BigDecimal value, int scale, RoundingMode rounding, boolean toDouble) throws IOException { - field(name); - if (value == null) { - generator.writeNull(); - } else { - if (toDouble) { - try { - generator.writeNumber(value.setScale(scale, rounding).doubleValue()); - } catch (ArithmeticException e) { - generator.writeString(value.toEngineeringString()); - } - } else { - generator.writeString(value.toEngineeringString()); - } - } - return this; - } - /** * Writes the binary content of the given BytesRef * Use {@link org.elasticsearch.common.xcontent.XContentParser#binaryValue()} to read the value back @@ -454,16 +313,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - /** - * Writes the binary content of the given BytesRef - * Use {@link org.elasticsearch.common.xcontent.XContentParser#binaryValue()} to read the value back - */ - public XContentBuilder field(XContentBuilderString name, BytesRef value) throws IOException { - field(name); - generator.writeBinary(value.bytes, value.offset, value.length); - return this; - } - /** * Writes the binary content of the given BytesReference * Use {@link org.elasticsearch.common.xcontent.XContentParser#binaryValue()} to read the value back @@ -477,29 +326,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - /** - * Writes the binary content of the given BytesReference - * Use {@link org.elasticsearch.common.xcontent.XContentParser#binaryValue()} to read the value back - */ - public XContentBuilder field(XContentBuilderString name, BytesReference value) throws IOException { - field(name); - if (!value.hasArray()) { - value = value.toBytesArray(); - } - generator.writeBinary(value.array(), value.arrayOffset(), value.length()); - return this; - } - - /** - * Writes the binary content of the given BytesRef as UTF-8 bytes - * Use {@link XContentParser#utf8Bytes()} to read the value back - */ - public XContentBuilder utf8Field(XContentBuilderString name, BytesRef value) throws IOException { - field(name); - generator.writeUTF8String(value.bytes, value.offset, value.length); - return this; - } - /** * Writes the binary content of the given BytesRef as UTF-8 bytes * Use {@link XContentParser#utf8Bytes()} to read the value back @@ -526,22 +352,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, Text value) throws IOException { - field(name); - if (value.hasBytes() && value.bytes().hasArray()) { - generator.writeUTF8String(value.bytes().array(), value.bytes().arrayOffset(), value.bytes().length()); - return this; - } - if (value.hasString()) { - generator.writeString(value.string()); - return this; - } - // TODO: TextBytesOptimization we can use a buffer here to convert it? maybe add a request to jackson to support InputStream as well? - BytesArray bytesArray = value.bytes().toBytesArray(); - generator.writeUTF8String(bytesArray.array(), bytesArray.arrayOffset(), bytesArray.length()); - return this; - } - public XContentBuilder field(String name, byte[] value, int offset, int length) throws IOException { field(name); generator.writeBinary(value, offset, length); @@ -554,12 +364,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, Map<String, Object> value) throws IOException { - field(name); - value(value); - return this; - } - public XContentBuilder field(String name, Iterable<?> value) throws IOException { if (value instanceof Path) { //treat Paths as single value @@ -575,21 +379,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, Iterable<?> value) throws IOException { - if (value instanceof Path) { - //treat Paths as single value - field(name); - value(value); - } else { - startArray(name); - for (Object o : value) { - value(o); - } - endArray(); - } - return this; - } - public XContentBuilder field(String name, boolean... value) throws IOException { startArray(name); for (boolean o : value) { @@ -599,16 +388,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - - public XContentBuilder field(XContentBuilderString name, boolean... value) throws IOException { - startArray(name); - for (boolean o : value) { - value(o); - } - endArray(); - return this; - } - public XContentBuilder field(String name, String... value) throws IOException { startArray(name); for (String o : value) { @@ -618,16 +397,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - - public XContentBuilder field(XContentBuilderString name, String... value) throws IOException { - startArray(name); - for (String o : value) { - value(o); - } - endArray(); - return this; - } - public XContentBuilder field(String name, Object... value) throws IOException { startArray(name); for (Object o : value) { @@ -637,15 +406,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, Object... value) throws IOException { - startArray(name); - for (Object o : value) { - value(o); - } - endArray(); - return this; - } - public XContentBuilder field(String name, int... value) throws IOException { startArray(name); for (Object o : value) { @@ -655,25 +415,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, int offset, int length, int... value) throws IOException { - assert ((offset >= 0) && (value.length > length)); - startArray(name); - for (int i = offset; i < length; i++) { - value(value[i]); - } - endArray(); - return this; - } - - public XContentBuilder field(XContentBuilderString name, int... value) throws IOException { - startArray(name); - for (Object o : value) { - value(o); - } - endArray(); - return this; - } - public XContentBuilder field(String name, long... value) throws IOException { startArray(name); for (Object o : value) { @@ -683,15 +424,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, long... value) throws IOException { - startArray(name); - for (Object o : value) { - value(o); - } - endArray(); - return this; - } - public XContentBuilder field(String name, float... value) throws IOException { startArray(name); for (Object o : value) { @@ -701,15 +433,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, float... value) throws IOException { - startArray(name); - for (Object o : value) { - value(o); - } - endArray(); - return this; - } - public XContentBuilder field(String name, double... value) throws IOException { startArray(name); for (Object o : value) { @@ -719,27 +442,12 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, double... value) throws IOException { - startArray(name); - for (Object o : value) { - value(o); - } - endArray(); - return this; - } - public XContentBuilder field(String name, Object value) throws IOException { field(name); writeValue(value); return this; } - public XContentBuilder field(XContentBuilderString name, Object value) throws IOException { - field(name); - writeValue(value); - return this; - } - public XContentBuilder value(Object value) throws IOException { writeValue(value); return this; @@ -751,12 +459,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, boolean value) throws IOException { - field(name); - generator.writeBoolean(value); - return this; - } - public XContentBuilder field(String name, byte[] value) throws IOException { field(name); if (value == null) { @@ -767,62 +469,31 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder field(XContentBuilderString name, byte[] value) throws IOException { - field(name); - return value(value); - } - public XContentBuilder field(String name, ReadableInstant date) throws IOException { field(name); return value(date); } - public XContentBuilder field(XContentBuilderString name, ReadableInstant date) throws IOException { - field(name); - return value(date); - } - public XContentBuilder field(String name, ReadableInstant date, DateTimeFormatter formatter) throws IOException { field(name); return value(date, formatter); } - public XContentBuilder field(XContentBuilderString name, ReadableInstant date, DateTimeFormatter formatter) throws IOException { - field(name); - return value(date, formatter); - } - public XContentBuilder field(String name, Date date) throws IOException { field(name); return value(date); } - public XContentBuilder field(XContentBuilderString name, Date date) throws IOException { - field(name); - return value(date); - } - public XContentBuilder field(String name, Date date, DateTimeFormatter formatter) throws IOException { field(name); return value(date, formatter); } - public XContentBuilder field(XContentBuilderString name, Date date, DateTimeFormatter formatter) throws IOException { - field(name); - return value(date, formatter); - } - public XContentBuilder nullField(String name) throws IOException { generator.writeNullField(name); return this; } - public XContentBuilder nullField(XContentBuilderString name) throws IOException { - field(name); - generator.writeNull(); - return this; - } - public XContentBuilder nullValue() throws IOException { generator.writeNull(); return this; @@ -843,7 +514,7 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder timeValueField(XContentBuilderString rawFieldName, XContentBuilderString readableFieldName, TimeValue timeValue) throws IOException { + public XContentBuilder timeValueField(String rawFieldName, String readableFieldName, TimeValue timeValue) throws IOException { if (humanReadable) { field(readableFieldName, timeValue.toString()); } @@ -851,7 +522,7 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder timeValueField(XContentBuilderString rawFieldName, XContentBuilderString readableFieldName, long rawTime) throws IOException { + public XContentBuilder timeValueField(String rawFieldName, String readableFieldName, long rawTime) throws IOException { if (humanReadable) { field(readableFieldName, new TimeValue(rawTime).toString()); } @@ -859,18 +530,6 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder dateValueField(XContentBuilderString rawFieldName, XContentBuilderString readableFieldName, long rawTimestamp) throws IOException { - if (humanReadable) { - field(readableFieldName, defaultDatePrinter.print(rawTimestamp)); - } - field(rawFieldName, rawTimestamp); - return this; - } - - public XContentBuilder timeValueField(String rawFieldName, String readableFieldName, TimeValue timeValue) throws IOException { - return timeValueField(rawFieldName, readableFieldName, timeValue.millis(), TimeUnit.MILLISECONDS); - } - public XContentBuilder timeValueField(String rawFieldName, String readableFieldName, long rawTime, TimeUnit timeUnit) throws IOException { if (humanReadable) { @@ -888,7 +547,7 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder byteSizeField(XContentBuilderString rawFieldName, XContentBuilderString readableFieldName, ByteSizeValue byteSizeValue) throws IOException { + public XContentBuilder byteSizeField(String rawFieldName, String readableFieldName, ByteSizeValue byteSizeValue) throws IOException { if (humanReadable) { field(readableFieldName, byteSizeValue.toString()); } @@ -896,7 +555,7 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder byteSizeField(XContentBuilderString rawFieldName, XContentBuilderString readableFieldName, long rawSize) throws IOException { + public XContentBuilder byteSizeField(String rawFieldName, String readableFieldName, long rawSize) throws IOException { if (humanReadable) { field(readableFieldName, new ByteSizeValue(rawSize).toString()); } @@ -904,7 +563,7 @@ public final class XContentBuilder implements BytesStream, Releasable { return this; } - public XContentBuilder percentageField(XContentBuilderString rawFieldName, XContentBuilderString readableFieldName, double percentage) throws IOException { + public XContentBuilder percentageField(String rawFieldName, String readableFieldName, double percentage) throws IOException { if (humanReadable) { field(readableFieldName, String.format(Locale.ROOT, "%1.1f%%", percentage)); } diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilderString.java b/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilderString.java deleted file mode 100644 index b056131f585..00000000000 --- a/core/src/main/java/org/elasticsearch/common/xcontent/XContentBuilderString.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.common.xcontent; - -/** - * TODO: remove this, it is just a wrapper that is no longer needed - */ -public class XContentBuilderString { - - private final String value; - - public XContentBuilderString(String value) { - this.value = value; - } - - public String value() { - return value; - } -} diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/XContentGenerator.java b/core/src/main/java/org/elasticsearch/common/xcontent/XContentGenerator.java index e11fc42b5a8..f23ae441989 100644 --- a/core/src/main/java/org/elasticsearch/common/xcontent/XContentGenerator.java +++ b/core/src/main/java/org/elasticsearch/common/xcontent/XContentGenerator.java @@ -46,8 +46,6 @@ public interface XContentGenerator extends Closeable { void writeFieldName(String name) throws IOException; - void writeFieldName(XContentString name) throws IOException; - void writeString(String text) throws IOException; void writeString(char[] text, int offset, int len) throws IOException; @@ -70,47 +68,26 @@ public interface XContentGenerator extends Closeable { void writeNull() throws IOException; - void writeStringField(String fieldName, String value) throws IOException; - void writeStringField(XContentString fieldName, String value) throws IOException; - void writeBooleanField(String fieldName, boolean value) throws IOException; - void writeBooleanField(XContentString fieldName, boolean value) throws IOException; - void writeNullField(String fieldName) throws IOException; - void writeNullField(XContentString fieldName) throws IOException; - void writeNumberField(String fieldName, int value) throws IOException; - void writeNumberField(XContentString fieldName, int value) throws IOException; - void writeNumberField(String fieldName, long value) throws IOException; - void writeNumberField(XContentString fieldName, long value) throws IOException; - void writeNumberField(String fieldName, double value) throws IOException; - void writeNumberField(XContentString fieldName, double value) throws IOException; - void writeNumberField(String fieldName, float value) throws IOException; - void writeNumberField(XContentString fieldName, float value) throws IOException; - void writeBinaryField(String fieldName, byte[] data) throws IOException; - void writeBinaryField(XContentString fieldName, byte[] data) throws IOException; - void writeArrayFieldStart(String fieldName) throws IOException; - void writeArrayFieldStart(XContentString fieldName) throws IOException; - void writeObjectFieldStart(String fieldName) throws IOException; - void writeObjectFieldStart(XContentString fieldName) throws IOException; - void writeRawField(String fieldName, InputStream content) throws IOException; void writeRawField(String fieldName, BytesReference content) throws IOException; diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/XContentParser.java b/core/src/main/java/org/elasticsearch/common/xcontent/XContentParser.java index 54de31c3150..f8513828636 100644 --- a/core/src/main/java/org/elasticsearch/common/xcontent/XContentParser.java +++ b/core/src/main/java/org/elasticsearch/common/xcontent/XContentParser.java @@ -218,10 +218,10 @@ public interface XContentParser extends Releasable { * <li>{@link XContentBuilder#field(String, byte[])}}</li> * </ul> * - * as well as via their <code>XContentBuilderString</code> variants of the separated value methods. + * as well as via their <code>String</code> variants of the separated value methods. * Note: Do not use this method to read values written with: * <ul> - * <li>{@link XContentBuilder#utf8Field(XContentBuilderString, org.apache.lucene.util.BytesRef)}</li> + * <li>{@link XContentBuilder#utf8Field(String, org.apache.lucene.util.BytesRef)}</li> * <li>{@link XContentBuilder#utf8Field(String, org.apache.lucene.util.BytesRef)}</li> * </ul> * diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/XContentString.java b/core/src/main/java/org/elasticsearch/common/xcontent/XContentString.java deleted file mode 100644 index 512703887af..00000000000 --- a/core/src/main/java/org/elasticsearch/common/xcontent/XContentString.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.common.xcontent; - -import com.fasterxml.jackson.core.io.SerializedString; - -/** - * - */ -public class XContentString extends SerializedString { - - public XContentString(String v) { - super(v); - } -} diff --git a/core/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContentGenerator.java b/core/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContentGenerator.java index 96cfd63f753..4148148e507 100644 --- a/core/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContentGenerator.java +++ b/core/src/main/java/org/elasticsearch/common/xcontent/json/JsonXContentGenerator.java @@ -34,7 +34,6 @@ import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentGenerator; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentString; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.support.filtering.FilterPathBasedFilter; @@ -157,11 +156,6 @@ public class JsonXContentGenerator implements XContentGenerator { generator.writeFieldName(name); } - @Override - public void writeFieldName(XContentString name) throws IOException { - generator.writeFieldName(name); - } - @Override public void writeString(String text) throws IOException { generator.writeString(text); @@ -222,111 +216,51 @@ public class JsonXContentGenerator implements XContentGenerator { generator.writeStringField(fieldName, value); } - @Override - public void writeStringField(XContentString fieldName, String value) throws IOException { - generator.writeFieldName(fieldName); - generator.writeString(value); - } - @Override public void writeBooleanField(String fieldName, boolean value) throws IOException { generator.writeBooleanField(fieldName, value); } - @Override - public void writeBooleanField(XContentString fieldName, boolean value) throws IOException { - generator.writeFieldName(fieldName); - generator.writeBoolean(value); - } - @Override public void writeNullField(String fieldName) throws IOException { generator.writeNullField(fieldName); } - @Override - public void writeNullField(XContentString fieldName) throws IOException { - generator.writeFieldName(fieldName); - generator.writeNull(); - } - @Override public void writeNumberField(String fieldName, int value) throws IOException { generator.writeNumberField(fieldName, value); } - @Override - public void writeNumberField(XContentString fieldName, int value) throws IOException { - generator.writeFieldName(fieldName); - generator.writeNumber(value); - } - @Override public void writeNumberField(String fieldName, long value) throws IOException { generator.writeNumberField(fieldName, value); } - @Override - public void writeNumberField(XContentString fieldName, long value) throws IOException { - generator.writeFieldName(fieldName); - generator.writeNumber(value); - } - @Override public void writeNumberField(String fieldName, double value) throws IOException { generator.writeNumberField(fieldName, value); } - @Override - public void writeNumberField(XContentString fieldName, double value) throws IOException { - generator.writeFieldName(fieldName); - generator.writeNumber(value); - } - @Override public void writeNumberField(String fieldName, float value) throws IOException { generator.writeNumberField(fieldName, value); } - @Override - public void writeNumberField(XContentString fieldName, float value) throws IOException { - generator.writeFieldName(fieldName); - generator.writeNumber(value); - } - @Override public void writeBinaryField(String fieldName, byte[] data) throws IOException { generator.writeBinaryField(fieldName, data); } - @Override - public void writeBinaryField(XContentString fieldName, byte[] value) throws IOException { - generator.writeFieldName(fieldName); - generator.writeBinary(value); - } - @Override public void writeArrayFieldStart(String fieldName) throws IOException { generator.writeArrayFieldStart(fieldName); } - @Override - public void writeArrayFieldStart(XContentString fieldName) throws IOException { - generator.writeFieldName(fieldName); - generator.writeStartArray(); - } - @Override public void writeObjectFieldStart(String fieldName) throws IOException { generator.writeObjectFieldStart(fieldName); } - @Override - public void writeObjectFieldStart(XContentString fieldName) throws IOException { - generator.writeFieldName(fieldName); - generator.writeStartObject(); - } - private void writeStartRaw(String fieldName) throws IOException { writeFieldName(fieldName); generator.writeRaw(':'); diff --git a/core/src/main/java/org/elasticsearch/discovery/DiscoveryStats.java b/core/src/main/java/org/elasticsearch/discovery/DiscoveryStats.java index dcd75b07651..74c6c3b7f35 100644 --- a/core/src/main/java/org/elasticsearch/discovery/DiscoveryStats.java +++ b/core/src/main/java/org/elasticsearch/discovery/DiscoveryStats.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.discovery.zen.publish.PendingClusterStateStats; import java.io.IOException; @@ -69,7 +68,7 @@ public class DiscoveryStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString DISCOVERY = new XContentBuilderString("discovery"); + static final String DISCOVERY = "discovery"; } public PendingClusterStateStats getQueueStats() { diff --git a/core/src/main/java/org/elasticsearch/discovery/zen/publish/PendingClusterStateStats.java b/core/src/main/java/org/elasticsearch/discovery/zen/publish/PendingClusterStateStats.java index 44265b0e481..3c4a2b84c50 100644 --- a/core/src/main/java/org/elasticsearch/discovery/zen/publish/PendingClusterStateStats.java +++ b/core/src/main/java/org/elasticsearch/discovery/zen/publish/PendingClusterStateStats.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -84,10 +83,10 @@ public class PendingClusterStateStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString QUEUE = new XContentBuilderString("cluster_state_queue"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString PENDING = new XContentBuilderString("pending"); - static final XContentBuilderString COMMITTED = new XContentBuilderString("committed"); + static final String QUEUE = "cluster_state_queue"; + static final String TOTAL = "total"; + static final String PENDING = "pending"; + static final String COMMITTED = "committed"; } @Override diff --git a/core/src/main/java/org/elasticsearch/http/HttpInfo.java b/core/src/main/java/org/elasticsearch/http/HttpInfo.java index df51de96d3b..0f285974e8a 100644 --- a/core/src/main/java/org/elasticsearch/http/HttpInfo.java +++ b/core/src/main/java/org/elasticsearch/http/HttpInfo.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -47,11 +46,11 @@ public class HttpInfo implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString HTTP = new XContentBuilderString("http"); - static final XContentBuilderString BOUND_ADDRESS = new XContentBuilderString("bound_address"); - static final XContentBuilderString PUBLISH_ADDRESS = new XContentBuilderString("publish_address"); - static final XContentBuilderString MAX_CONTENT_LENGTH = new XContentBuilderString("max_content_length"); - static final XContentBuilderString MAX_CONTENT_LENGTH_IN_BYTES = new XContentBuilderString("max_content_length_in_bytes"); + static final String HTTP = "http"; + static final String BOUND_ADDRESS = "bound_address"; + static final String PUBLISH_ADDRESS = "publish_address"; + static final String MAX_CONTENT_LENGTH = "max_content_length"; + static final String MAX_CONTENT_LENGTH_IN_BYTES = "max_content_length_in_bytes"; } @Override diff --git a/core/src/main/java/org/elasticsearch/http/HttpStats.java b/core/src/main/java/org/elasticsearch/http/HttpStats.java index 7cbe8a7ea55..973821f4a5e 100644 --- a/core/src/main/java/org/elasticsearch/http/HttpStats.java +++ b/core/src/main/java/org/elasticsearch/http/HttpStats.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -69,9 +68,9 @@ public class HttpStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString HTTP = new XContentBuilderString("http"); - static final XContentBuilderString CURRENT_OPEN = new XContentBuilderString("current_open"); - static final XContentBuilderString TOTAL_OPENED = new XContentBuilderString("total_opened"); + static final String HTTP = "http"; + static final String CURRENT_OPEN = "current_open"; + static final String TOTAL_OPENED = "total_opened"; } @Override @@ -82,4 +81,4 @@ public class HttpStats implements Streamable, ToXContent { builder.endObject(); return builder; } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/elasticsearch/index/cache/query/QueryCacheStats.java b/core/src/main/java/org/elasticsearch/index/cache/query/QueryCacheStats.java index 62b8d3ba138..fcbb6190048 100644 --- a/core/src/main/java/org/elasticsearch/index/cache/query/QueryCacheStats.java +++ b/core/src/main/java/org/elasticsearch/index/cache/query/QueryCacheStats.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -149,15 +148,15 @@ public class QueryCacheStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString QUERY_CACHE = new XContentBuilderString("query_cache"); - static final XContentBuilderString MEMORY_SIZE = new XContentBuilderString("memory_size"); - static final XContentBuilderString MEMORY_SIZE_IN_BYTES = new XContentBuilderString("memory_size_in_bytes"); - static final XContentBuilderString TOTAL_COUNT = new XContentBuilderString("total_count"); - static final XContentBuilderString HIT_COUNT = new XContentBuilderString("hit_count"); - static final XContentBuilderString MISS_COUNT = new XContentBuilderString("miss_count"); - static final XContentBuilderString CACHE_SIZE = new XContentBuilderString("cache_size"); - static final XContentBuilderString CACHE_COUNT = new XContentBuilderString("cache_count"); - static final XContentBuilderString EVICTIONS = new XContentBuilderString("evictions"); + static final String QUERY_CACHE = "query_cache"; + static final String MEMORY_SIZE = "memory_size"; + static final String MEMORY_SIZE_IN_BYTES = "memory_size_in_bytes"; + static final String TOTAL_COUNT = "total_count"; + static final String HIT_COUNT = "hit_count"; + static final String MISS_COUNT = "miss_count"; + static final String CACHE_SIZE = "cache_size"; + static final String CACHE_COUNT = "cache_count"; + static final String EVICTIONS = "evictions"; } } diff --git a/core/src/main/java/org/elasticsearch/index/cache/request/RequestCacheStats.java b/core/src/main/java/org/elasticsearch/index/cache/request/RequestCacheStats.java index 9186fadbcee..5eb9775b816 100644 --- a/core/src/main/java/org/elasticsearch/index/cache/request/RequestCacheStats.java +++ b/core/src/main/java/org/elasticsearch/index/cache/request/RequestCacheStats.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -103,11 +102,11 @@ public class RequestCacheStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString REQUEST_CACHE_STATS = new XContentBuilderString("request_cache"); - static final XContentBuilderString MEMORY_SIZE = new XContentBuilderString("memory_size"); - static final XContentBuilderString MEMORY_SIZE_IN_BYTES = new XContentBuilderString("memory_size_in_bytes"); - static final XContentBuilderString EVICTIONS = new XContentBuilderString("evictions"); - static final XContentBuilderString HIT_COUNT = new XContentBuilderString("hit_count"); - static final XContentBuilderString MISS_COUNT = new XContentBuilderString("miss_count"); + static final String REQUEST_CACHE_STATS = "request_cache"; + static final String MEMORY_SIZE = "memory_size"; + static final String MEMORY_SIZE_IN_BYTES = "memory_size_in_bytes"; + static final String EVICTIONS = "evictions"; + static final String HIT_COUNT = "hit_count"; + static final String MISS_COUNT = "miss_count"; } } diff --git a/core/src/main/java/org/elasticsearch/index/engine/CommitStats.java b/core/src/main/java/org/elasticsearch/index/engine/CommitStats.java index 050c23701f8..3656dcbfb96 100644 --- a/core/src/main/java/org/elasticsearch/index/engine/CommitStats.java +++ b/core/src/main/java/org/elasticsearch/index/engine/CommitStats.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Map; @@ -111,11 +110,11 @@ public final class CommitStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString GENERATION = new XContentBuilderString("generation"); - static final XContentBuilderString USER_DATA = new XContentBuilderString("user_data"); - static final XContentBuilderString ID = new XContentBuilderString("id"); - static final XContentBuilderString COMMIT = new XContentBuilderString("commit"); - static final XContentBuilderString NUM_DOCS = new XContentBuilderString("num_docs"); + static final String GENERATION = "generation"; + static final String USER_DATA = "user_data"; + static final String ID = "id"; + static final String COMMIT = "commit"; + static final String NUM_DOCS = "num_docs"; } diff --git a/core/src/main/java/org/elasticsearch/index/engine/SegmentsStats.java b/core/src/main/java/org/elasticsearch/index/engine/SegmentsStats.java index b4b80e32680..dcd97dfef0e 100644 --- a/core/src/main/java/org/elasticsearch/index/engine/SegmentsStats.java +++ b/core/src/main/java/org/elasticsearch/index/engine/SegmentsStats.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Iterator; @@ -325,34 +324,34 @@ public class SegmentsStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString SEGMENTS = new XContentBuilderString("segments"); - static final XContentBuilderString COUNT = new XContentBuilderString("count"); - static final XContentBuilderString MEMORY = new XContentBuilderString("memory"); - static final XContentBuilderString MEMORY_IN_BYTES = new XContentBuilderString("memory_in_bytes"); - static final XContentBuilderString TERMS_MEMORY = new XContentBuilderString("terms_memory"); - static final XContentBuilderString TERMS_MEMORY_IN_BYTES = new XContentBuilderString("terms_memory_in_bytes"); - static final XContentBuilderString STORED_FIELDS_MEMORY = new XContentBuilderString("stored_fields_memory"); - static final XContentBuilderString STORED_FIELDS_MEMORY_IN_BYTES = new XContentBuilderString("stored_fields_memory_in_bytes"); - static final XContentBuilderString TERM_VECTORS_MEMORY = new XContentBuilderString("term_vectors_memory"); - static final XContentBuilderString TERM_VECTORS_MEMORY_IN_BYTES = new XContentBuilderString("term_vectors_memory_in_bytes"); - static final XContentBuilderString NORMS_MEMORY = new XContentBuilderString("norms_memory"); - static final XContentBuilderString NORMS_MEMORY_IN_BYTES = new XContentBuilderString("norms_memory_in_bytes"); - static final XContentBuilderString POINTS_MEMORY = new XContentBuilderString("points_memory"); - static final XContentBuilderString POINTS_MEMORY_IN_BYTES = new XContentBuilderString("points_memory_in_bytes"); - static final XContentBuilderString DOC_VALUES_MEMORY = new XContentBuilderString("doc_values_memory"); - static final XContentBuilderString DOC_VALUES_MEMORY_IN_BYTES = new XContentBuilderString("doc_values_memory_in_bytes"); - static final XContentBuilderString INDEX_WRITER_MEMORY = new XContentBuilderString("index_writer_memory"); - static final XContentBuilderString INDEX_WRITER_MEMORY_IN_BYTES = new XContentBuilderString("index_writer_memory_in_bytes"); - static final XContentBuilderString INDEX_WRITER_MAX_MEMORY = new XContentBuilderString("index_writer_max_memory"); - static final XContentBuilderString INDEX_WRITER_MAX_MEMORY_IN_BYTES = new XContentBuilderString("index_writer_max_memory_in_bytes"); - static final XContentBuilderString VERSION_MAP_MEMORY = new XContentBuilderString("version_map_memory"); - static final XContentBuilderString VERSION_MAP_MEMORY_IN_BYTES = new XContentBuilderString("version_map_memory_in_bytes"); - static final XContentBuilderString FIXED_BIT_SET = new XContentBuilderString("fixed_bit_set"); - static final XContentBuilderString FIXED_BIT_SET_MEMORY_IN_BYTES = new XContentBuilderString("fixed_bit_set_memory_in_bytes"); - static final XContentBuilderString FILE_SIZES = new XContentBuilderString("file_sizes"); - static final XContentBuilderString SIZE = new XContentBuilderString("size"); - static final XContentBuilderString SIZE_IN_BYTES = new XContentBuilderString("size_in_bytes"); - static final XContentBuilderString DESCRIPTION = new XContentBuilderString("description"); + static final String SEGMENTS = "segments"; + static final String COUNT = "count"; + static final String MEMORY = "memory"; + static final String MEMORY_IN_BYTES = "memory_in_bytes"; + static final String TERMS_MEMORY = "terms_memory"; + static final String TERMS_MEMORY_IN_BYTES = "terms_memory_in_bytes"; + static final String STORED_FIELDS_MEMORY = "stored_fields_memory"; + static final String STORED_FIELDS_MEMORY_IN_BYTES = "stored_fields_memory_in_bytes"; + static final String TERM_VECTORS_MEMORY = "term_vectors_memory"; + static final String TERM_VECTORS_MEMORY_IN_BYTES = "term_vectors_memory_in_bytes"; + static final String NORMS_MEMORY = "norms_memory"; + static final String NORMS_MEMORY_IN_BYTES = "norms_memory_in_bytes"; + static final String POINTS_MEMORY = "points_memory"; + static final String POINTS_MEMORY_IN_BYTES = "points_memory_in_bytes"; + static final String DOC_VALUES_MEMORY = "doc_values_memory"; + static final String DOC_VALUES_MEMORY_IN_BYTES = "doc_values_memory_in_bytes"; + static final String INDEX_WRITER_MEMORY = "index_writer_memory"; + static final String INDEX_WRITER_MEMORY_IN_BYTES = "index_writer_memory_in_bytes"; + static final String INDEX_WRITER_MAX_MEMORY = "index_writer_max_memory"; + static final String INDEX_WRITER_MAX_MEMORY_IN_BYTES = "index_writer_max_memory_in_bytes"; + static final String VERSION_MAP_MEMORY = "version_map_memory"; + static final String VERSION_MAP_MEMORY_IN_BYTES = "version_map_memory_in_bytes"; + static final String FIXED_BIT_SET = "fixed_bit_set"; + static final String FIXED_BIT_SET_MEMORY_IN_BYTES = "fixed_bit_set_memory_in_bytes"; + static final String FILE_SIZES = "file_sizes"; + static final String SIZE = "size"; + static final String SIZE_IN_BYTES = "size_in_bytes"; + static final String DESCRIPTION = "description"; } @Override diff --git a/core/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java b/core/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java index 3f3f1b550c3..d8548f72476 100644 --- a/core/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java +++ b/core/src/main/java/org/elasticsearch/index/fielddata/FieldDataStats.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -150,10 +149,10 @@ public class FieldDataStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString FIELDDATA = new XContentBuilderString("fielddata"); - static final XContentBuilderString MEMORY_SIZE = new XContentBuilderString("memory_size"); - static final XContentBuilderString MEMORY_SIZE_IN_BYTES = new XContentBuilderString("memory_size_in_bytes"); - static final XContentBuilderString EVICTIONS = new XContentBuilderString("evictions"); - static final XContentBuilderString FIELDS = new XContentBuilderString("fields"); + static final String FIELDDATA = "fielddata"; + static final String MEMORY_SIZE = "memory_size"; + static final String MEMORY_SIZE_IN_BYTES = "memory_size_in_bytes"; + static final String EVICTIONS = "evictions"; + static final String FIELDS = "fields"; } } diff --git a/core/src/main/java/org/elasticsearch/index/flush/FlushStats.java b/core/src/main/java/org/elasticsearch/index/flush/FlushStats.java index a1d18c13506..600651ad306 100644 --- a/core/src/main/java/org/elasticsearch/index/flush/FlushStats.java +++ b/core/src/main/java/org/elasticsearch/index/flush/FlushStats.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -98,10 +97,10 @@ public class FlushStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString FLUSH = new XContentBuilderString("flush"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString TOTAL_TIME = new XContentBuilderString("total_time"); - static final XContentBuilderString TOTAL_TIME_IN_MILLIS = new XContentBuilderString("total_time_in_millis"); + static final String FLUSH = "flush"; + static final String TOTAL = "total"; + static final String TOTAL_TIME = "total_time"; + static final String TOTAL_TIME_IN_MILLIS = "total_time_in_millis"; } @Override @@ -115,4 +114,4 @@ public class FlushStats implements Streamable, ToXContent { out.writeVLong(total); out.writeVLong(totalTimeInMillis); } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/elasticsearch/index/get/GetResult.java b/core/src/main/java/org/elasticsearch/index/get/GetResult.java index d2436949503..428db08dbcb 100644 --- a/core/src/main/java/org/elasticsearch/index/get/GetResult.java +++ b/core/src/main/java/org/elasticsearch/index/get/GetResult.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.search.lookup.SourceLookup; @@ -199,12 +198,12 @@ public class GetResult implements Streamable, Iterable<GetField>, ToXContent { } static final class Fields { - static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - static final XContentBuilderString _TYPE = new XContentBuilderString("_type"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); - static final XContentBuilderString _VERSION = new XContentBuilderString("_version"); - static final XContentBuilderString FOUND = new XContentBuilderString("found"); - static final XContentBuilderString FIELDS = new XContentBuilderString("fields"); + static final String _INDEX = "_index"; + static final String _TYPE = "_type"; + static final String _ID = "_id"; + static final String _VERSION = "_version"; + static final String FOUND = "found"; + static final String FIELDS = "fields"; } public XContentBuilder toXContentEmbedded(XContentBuilder builder, Params params) throws IOException { diff --git a/core/src/main/java/org/elasticsearch/index/get/GetStats.java b/core/src/main/java/org/elasticsearch/index/get/GetStats.java index 876c9ac565a..10b4f64c19e 100644 --- a/core/src/main/java/org/elasticsearch/index/get/GetStats.java +++ b/core/src/main/java/org/elasticsearch/index/get/GetStats.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -124,17 +123,17 @@ public class GetStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString GET = new XContentBuilderString("get"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString TIME = new XContentBuilderString("getTime"); - static final XContentBuilderString TIME_IN_MILLIS = new XContentBuilderString("time_in_millis"); - static final XContentBuilderString EXISTS_TOTAL = new XContentBuilderString("exists_total"); - static final XContentBuilderString EXISTS_TIME = new XContentBuilderString("exists_time"); - static final XContentBuilderString EXISTS_TIME_IN_MILLIS = new XContentBuilderString("exists_time_in_millis"); - static final XContentBuilderString MISSING_TOTAL = new XContentBuilderString("missing_total"); - static final XContentBuilderString MISSING_TIME = new XContentBuilderString("missing_time"); - static final XContentBuilderString MISSING_TIME_IN_MILLIS = new XContentBuilderString("missing_time_in_millis"); - static final XContentBuilderString CURRENT = new XContentBuilderString("current"); + static final String GET = "get"; + static final String TOTAL = "total"; + static final String TIME = "getTime"; + static final String TIME_IN_MILLIS = "time_in_millis"; + static final String EXISTS_TOTAL = "exists_total"; + static final String EXISTS_TIME = "exists_time"; + static final String EXISTS_TIME_IN_MILLIS = "exists_time_in_millis"; + static final String MISSING_TOTAL = "missing_total"; + static final String MISSING_TIME = "missing_time"; + static final String MISSING_TIME_IN_MILLIS = "missing_time_in_millis"; + static final String CURRENT = "current"; } public static GetStats readGetStats(StreamInput in) throws IOException { diff --git a/core/src/main/java/org/elasticsearch/index/merge/MergeStats.java b/core/src/main/java/org/elasticsearch/index/merge/MergeStats.java index a6f1d1c3291..ee8c08f00d0 100644 --- a/core/src/main/java/org/elasticsearch/index/merge/MergeStats.java +++ b/core/src/main/java/org/elasticsearch/index/merge/MergeStats.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -210,23 +209,23 @@ public class MergeStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString MERGES = new XContentBuilderString("merges"); - static final XContentBuilderString CURRENT = new XContentBuilderString("current"); - static final XContentBuilderString CURRENT_DOCS = new XContentBuilderString("current_docs"); - static final XContentBuilderString CURRENT_SIZE = new XContentBuilderString("current_size"); - static final XContentBuilderString CURRENT_SIZE_IN_BYTES = new XContentBuilderString("current_size_in_bytes"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString TOTAL_TIME = new XContentBuilderString("total_time"); - static final XContentBuilderString TOTAL_TIME_IN_MILLIS = new XContentBuilderString("total_time_in_millis"); - static final XContentBuilderString TOTAL_STOPPED_TIME = new XContentBuilderString("total_stopped_time"); - static final XContentBuilderString TOTAL_STOPPED_TIME_IN_MILLIS = new XContentBuilderString("total_stopped_time_in_millis"); - static final XContentBuilderString TOTAL_THROTTLED_TIME = new XContentBuilderString("total_throttled_time"); - static final XContentBuilderString TOTAL_THROTTLED_TIME_IN_MILLIS = new XContentBuilderString("total_throttled_time_in_millis"); - static final XContentBuilderString TOTAL_DOCS = new XContentBuilderString("total_docs"); - static final XContentBuilderString TOTAL_SIZE = new XContentBuilderString("total_size"); - static final XContentBuilderString TOTAL_SIZE_IN_BYTES = new XContentBuilderString("total_size_in_bytes"); - static final XContentBuilderString TOTAL_THROTTLE_BYTES_PER_SEC_IN_BYTES = new XContentBuilderString("total_auto_throttle_in_bytes"); - static final XContentBuilderString TOTAL_THROTTLE_BYTES_PER_SEC = new XContentBuilderString("total_auto_throttle"); + static final String MERGES = "merges"; + static final String CURRENT = "current"; + static final String CURRENT_DOCS = "current_docs"; + static final String CURRENT_SIZE = "current_size"; + static final String CURRENT_SIZE_IN_BYTES = "current_size_in_bytes"; + static final String TOTAL = "total"; + static final String TOTAL_TIME = "total_time"; + static final String TOTAL_TIME_IN_MILLIS = "total_time_in_millis"; + static final String TOTAL_STOPPED_TIME = "total_stopped_time"; + static final String TOTAL_STOPPED_TIME_IN_MILLIS = "total_stopped_time_in_millis"; + static final String TOTAL_THROTTLED_TIME = "total_throttled_time"; + static final String TOTAL_THROTTLED_TIME_IN_MILLIS = "total_throttled_time_in_millis"; + static final String TOTAL_DOCS = "total_docs"; + static final String TOTAL_SIZE = "total_size"; + static final String TOTAL_SIZE_IN_BYTES = "total_size_in_bytes"; + static final String TOTAL_THROTTLE_BYTES_PER_SEC_IN_BYTES = "total_auto_throttle_in_bytes"; + static final String TOTAL_THROTTLE_BYTES_PER_SEC = "total_auto_throttle"; } @Override diff --git a/core/src/main/java/org/elasticsearch/index/percolator/PercolatorQueryCacheStats.java b/core/src/main/java/org/elasticsearch/index/percolator/PercolatorQueryCacheStats.java index a8e3b7f4799..cbc21286e20 100644 --- a/core/src/main/java/org/elasticsearch/index/percolator/PercolatorQueryCacheStats.java +++ b/core/src/main/java/org/elasticsearch/index/percolator/PercolatorQueryCacheStats.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -68,8 +67,8 @@ public class PercolatorQueryCacheStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString PERCOLATOR = new XContentBuilderString("percolator"); - static final XContentBuilderString QUERIES = new XContentBuilderString("num_queries"); + static final String PERCOLATOR = "percolator"; + static final String QUERIES = "num_queries"; } public static PercolatorQueryCacheStats readPercolateStats(StreamInput in) throws IOException { diff --git a/core/src/main/java/org/elasticsearch/index/recovery/RecoveryStats.java b/core/src/main/java/org/elasticsearch/index/recovery/RecoveryStats.java index 3f512b3e123..750e77092ce 100644 --- a/core/src/main/java/org/elasticsearch/index/recovery/RecoveryStats.java +++ b/core/src/main/java/org/elasticsearch/index/recovery/RecoveryStats.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; @@ -115,11 +114,11 @@ public class RecoveryStats implements ToXContent, Streamable { } static final class Fields { - static final XContentBuilderString RECOVERY = new XContentBuilderString("recovery"); - static final XContentBuilderString CURRENT_AS_SOURCE = new XContentBuilderString("current_as_source"); - static final XContentBuilderString CURRENT_AS_TARGET = new XContentBuilderString("current_as_target"); - static final XContentBuilderString THROTTLE_TIME = new XContentBuilderString("throttle_time"); - static final XContentBuilderString THROTTLE_TIME_IN_MILLIS = new XContentBuilderString("throttle_time_in_millis"); + static final String RECOVERY = "recovery"; + static final String CURRENT_AS_SOURCE = "current_as_source"; + static final String CURRENT_AS_TARGET = "current_as_target"; + static final String THROTTLE_TIME = "throttle_time"; + static final String THROTTLE_TIME_IN_MILLIS = "throttle_time_in_millis"; } @Override diff --git a/core/src/main/java/org/elasticsearch/index/refresh/RefreshStats.java b/core/src/main/java/org/elasticsearch/index/refresh/RefreshStats.java index 4ef6e9dbb31..9b9b4673acc 100644 --- a/core/src/main/java/org/elasticsearch/index/refresh/RefreshStats.java +++ b/core/src/main/java/org/elasticsearch/index/refresh/RefreshStats.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -98,10 +97,10 @@ public class RefreshStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString REFRESH = new XContentBuilderString("refresh"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString TOTAL_TIME = new XContentBuilderString("total_time"); - static final XContentBuilderString TOTAL_TIME_IN_MILLIS = new XContentBuilderString("total_time_in_millis"); + static final String REFRESH = "refresh"; + static final String TOTAL = "total"; + static final String TOTAL_TIME = "total_time"; + static final String TOTAL_TIME_IN_MILLIS = "total_time_in_millis"; } @Override @@ -115,4 +114,4 @@ public class RefreshStats implements Streamable, ToXContent { out.writeVLong(total); out.writeVLong(totalTimeInMillis); } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java b/core/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java index 83252103c40..d514571d0e2 100644 --- a/core/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java +++ b/core/src/main/java/org/elasticsearch/index/search/stats/SearchStats.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import java.io.IOException; @@ -320,25 +319,25 @@ public class SearchStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString SEARCH = new XContentBuilderString("search"); - static final XContentBuilderString OPEN_CONTEXTS = new XContentBuilderString("open_contexts"); - static final XContentBuilderString GROUPS = new XContentBuilderString("groups"); - static final XContentBuilderString QUERY_TOTAL = new XContentBuilderString("query_total"); - static final XContentBuilderString QUERY_TIME = new XContentBuilderString("query_time"); - static final XContentBuilderString QUERY_TIME_IN_MILLIS = new XContentBuilderString("query_time_in_millis"); - static final XContentBuilderString QUERY_CURRENT = new XContentBuilderString("query_current"); - static final XContentBuilderString FETCH_TOTAL = new XContentBuilderString("fetch_total"); - static final XContentBuilderString FETCH_TIME = new XContentBuilderString("fetch_time"); - static final XContentBuilderString FETCH_TIME_IN_MILLIS = new XContentBuilderString("fetch_time_in_millis"); - static final XContentBuilderString FETCH_CURRENT = new XContentBuilderString("fetch_current"); - static final XContentBuilderString SCROLL_TOTAL = new XContentBuilderString("scroll_total"); - static final XContentBuilderString SCROLL_TIME = new XContentBuilderString("scroll_time"); - static final XContentBuilderString SCROLL_TIME_IN_MILLIS = new XContentBuilderString("scroll_time_in_millis"); - static final XContentBuilderString SCROLL_CURRENT = new XContentBuilderString("scroll_current"); - static final XContentBuilderString SUGGEST_TOTAL = new XContentBuilderString("suggest_total"); - static final XContentBuilderString SUGGEST_TIME = new XContentBuilderString("suggest_time"); - static final XContentBuilderString SUGGEST_TIME_IN_MILLIS = new XContentBuilderString("suggest_time_in_millis"); - static final XContentBuilderString SUGGEST_CURRENT = new XContentBuilderString("suggest_current"); + static final String SEARCH = "search"; + static final String OPEN_CONTEXTS = "open_contexts"; + static final String GROUPS = "groups"; + static final String QUERY_TOTAL = "query_total"; + static final String QUERY_TIME = "query_time"; + static final String QUERY_TIME_IN_MILLIS = "query_time_in_millis"; + static final String QUERY_CURRENT = "query_current"; + static final String FETCH_TOTAL = "fetch_total"; + static final String FETCH_TIME = "fetch_time"; + static final String FETCH_TIME_IN_MILLIS = "fetch_time_in_millis"; + static final String FETCH_CURRENT = "fetch_current"; + static final String SCROLL_TOTAL = "scroll_total"; + static final String SCROLL_TIME = "scroll_time"; + static final String SCROLL_TIME_IN_MILLIS = "scroll_time_in_millis"; + static final String SCROLL_CURRENT = "scroll_current"; + static final String SUGGEST_TOTAL = "suggest_total"; + static final String SUGGEST_TIME = "suggest_time"; + static final String SUGGEST_TIME_IN_MILLIS = "suggest_time_in_millis"; + static final String SUGGEST_CURRENT = "suggest_current"; } public static SearchStats readSearchStats(StreamInput in) throws IOException { diff --git a/core/src/main/java/org/elasticsearch/index/shard/DocsStats.java b/core/src/main/java/org/elasticsearch/index/shard/DocsStats.java index 3ce99e4e98c..bfb95b426b1 100644 --- a/core/src/main/java/org/elasticsearch/index/shard/DocsStats.java +++ b/core/src/main/java/org/elasticsearch/index/shard/DocsStats.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -88,8 +87,8 @@ public class DocsStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString DOCS = new XContentBuilderString("docs"); - static final XContentBuilderString COUNT = new XContentBuilderString("count"); - static final XContentBuilderString DELETED = new XContentBuilderString("deleted"); + static final String DOCS = "docs"; + static final String COUNT = "count"; + static final String DELETED = "deleted"; } } diff --git a/core/src/main/java/org/elasticsearch/index/shard/IndexingStats.java b/core/src/main/java/org/elasticsearch/index/shard/IndexingStats.java index beafbefddcd..97f9dd2b92f 100644 --- a/core/src/main/java/org/elasticsearch/index/shard/IndexingStats.java +++ b/core/src/main/java/org/elasticsearch/index/shard/IndexingStats.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.HashMap; @@ -269,21 +268,21 @@ public class IndexingStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString INDEXING = new XContentBuilderString("indexing"); - static final XContentBuilderString TYPES = new XContentBuilderString("types"); - static final XContentBuilderString INDEX_TOTAL = new XContentBuilderString("index_total"); - static final XContentBuilderString INDEX_TIME = new XContentBuilderString("index_time"); - static final XContentBuilderString INDEX_TIME_IN_MILLIS = new XContentBuilderString("index_time_in_millis"); - static final XContentBuilderString INDEX_CURRENT = new XContentBuilderString("index_current"); - static final XContentBuilderString INDEX_FAILED = new XContentBuilderString("index_failed"); - static final XContentBuilderString DELETE_TOTAL = new XContentBuilderString("delete_total"); - static final XContentBuilderString DELETE_TIME = new XContentBuilderString("delete_time"); - static final XContentBuilderString DELETE_TIME_IN_MILLIS = new XContentBuilderString("delete_time_in_millis"); - static final XContentBuilderString DELETE_CURRENT = new XContentBuilderString("delete_current"); - static final XContentBuilderString NOOP_UPDATE_TOTAL = new XContentBuilderString("noop_update_total"); - static final XContentBuilderString IS_THROTTLED = new XContentBuilderString("is_throttled"); - static final XContentBuilderString THROTTLED_TIME_IN_MILLIS = new XContentBuilderString("throttle_time_in_millis"); - static final XContentBuilderString THROTTLED_TIME = new XContentBuilderString("throttle_time"); + static final String INDEXING = "indexing"; + static final String TYPES = "types"; + static final String INDEX_TOTAL = "index_total"; + static final String INDEX_TIME = "index_time"; + static final String INDEX_TIME_IN_MILLIS = "index_time_in_millis"; + static final String INDEX_CURRENT = "index_current"; + static final String INDEX_FAILED = "index_failed"; + static final String DELETE_TOTAL = "delete_total"; + static final String DELETE_TIME = "delete_time"; + static final String DELETE_TIME_IN_MILLIS = "delete_time_in_millis"; + static final String DELETE_CURRENT = "delete_current"; + static final String NOOP_UPDATE_TOTAL = "noop_update_total"; + static final String IS_THROTTLED = "is_throttled"; + static final String THROTTLED_TIME_IN_MILLIS = "throttle_time_in_millis"; + static final String THROTTLED_TIME = "throttle_time"; } public static IndexingStats readIndexingStats(StreamInput in) throws IOException { diff --git a/core/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java b/core/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java index 08af2843ce4..60b7ec2112e 100644 --- a/core/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java +++ b/core/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java @@ -31,7 +31,6 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.FromXContentBuilder; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.store.StoreFileMetaData; @@ -220,13 +219,13 @@ public class BlobStoreIndexShardSnapshot implements ToXContent, FromXContentBuil } static final class Fields { - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString PHYSICAL_NAME = new XContentBuilderString("physical_name"); - static final XContentBuilderString LENGTH = new XContentBuilderString("length"); - static final XContentBuilderString CHECKSUM = new XContentBuilderString("checksum"); - static final XContentBuilderString PART_SIZE = new XContentBuilderString("part_size"); - static final XContentBuilderString WRITTEN_BY = new XContentBuilderString("written_by"); - static final XContentBuilderString META_HASH = new XContentBuilderString("meta_hash"); + static final String NAME = "name"; + static final String PHYSICAL_NAME = "physical_name"; + static final String LENGTH = "length"; + static final String CHECKSUM = "checksum"; + static final String PART_SIZE = "part_size"; + static final String WRITTEN_BY = "written_by"; + static final String META_HASH = "meta_hash"; } /** @@ -426,13 +425,13 @@ public class BlobStoreIndexShardSnapshot implements ToXContent, FromXContentBuil } static final class Fields { - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString INDEX_VERSION = new XContentBuilderString("index_version"); - static final XContentBuilderString START_TIME = new XContentBuilderString("start_time"); - static final XContentBuilderString TIME = new XContentBuilderString("time"); - static final XContentBuilderString NUMBER_OF_FILES = new XContentBuilderString("number_of_files"); - static final XContentBuilderString TOTAL_SIZE = new XContentBuilderString("total_size"); - static final XContentBuilderString FILES = new XContentBuilderString("files"); + static final String NAME = "name"; + static final String INDEX_VERSION = "index_version"; + static final String START_TIME = "start_time"; + static final String TIME = "time"; + static final String NUMBER_OF_FILES = "number_of_files"; + static final String TOTAL_SIZE = "total_size"; + static final String FILES = "files"; } static final class ParseFields { diff --git a/core/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshots.java b/core/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshots.java index 7b7a8dd9829..5b66d9b6f6f 100644 --- a/core/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshots.java +++ b/core/src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshots.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.common.xcontent.FromXContentBuilder; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.snapshots.blobstore.BlobStoreIndexShardSnapshot.FileInfo; @@ -149,8 +148,8 @@ public class BlobStoreIndexShardSnapshots implements Iterable<SnapshotFiles>, To } static final class Fields { - static final XContentBuilderString FILES = new XContentBuilderString("files"); - static final XContentBuilderString SNAPSHOTS = new XContentBuilderString("snapshots"); + static final String FILES = "files"; + static final String SNAPSHOTS = "snapshots"; } static final class ParseFields { diff --git a/core/src/main/java/org/elasticsearch/index/store/StoreStats.java b/core/src/main/java/org/elasticsearch/index/store/StoreStats.java index 0eb720456c5..d777d7b7830 100644 --- a/core/src/main/java/org/elasticsearch/index/store/StoreStats.java +++ b/core/src/main/java/org/elasticsearch/index/store/StoreStats.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -108,10 +107,10 @@ public class StoreStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString STORE = new XContentBuilderString("store"); - static final XContentBuilderString SIZE = new XContentBuilderString("size"); - static final XContentBuilderString SIZE_IN_BYTES = new XContentBuilderString("size_in_bytes"); - static final XContentBuilderString THROTTLE_TIME = new XContentBuilderString("throttle_time"); - static final XContentBuilderString THROTTLE_TIME_IN_MILLIS = new XContentBuilderString("throttle_time_in_millis"); + static final String STORE = "store"; + static final String SIZE = "size"; + static final String SIZE_IN_BYTES = "size_in_bytes"; + static final String THROTTLE_TIME = "throttle_time"; + static final String THROTTLE_TIME_IN_MILLIS = "throttle_time_in_millis"; } } diff --git a/core/src/main/java/org/elasticsearch/index/translog/TranslogStats.java b/core/src/main/java/org/elasticsearch/index/translog/TranslogStats.java index a4431b520cd..263a658c08d 100644 --- a/core/src/main/java/org/elasticsearch/index/translog/TranslogStats.java +++ b/core/src/main/java/org/elasticsearch/index/translog/TranslogStats.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -77,10 +76,10 @@ public class TranslogStats extends ToXContentToBytes implements Streamable { } static final class Fields { - static final XContentBuilderString TRANSLOG = new XContentBuilderString("translog"); - static final XContentBuilderString OPERATIONS = new XContentBuilderString("operations"); - static final XContentBuilderString SIZE = new XContentBuilderString("size"); - static final XContentBuilderString SIZE_IN_BYTES = new XContentBuilderString("size_in_bytes"); + static final String TRANSLOG = "translog"; + static final String OPERATIONS = "operations"; + static final String SIZE = "size"; + static final String SIZE_IN_BYTES = "size_in_bytes"; } @Override diff --git a/core/src/main/java/org/elasticsearch/index/warmer/WarmerStats.java b/core/src/main/java/org/elasticsearch/index/warmer/WarmerStats.java index 2e68d14cf50..233dbf4f5fe 100644 --- a/core/src/main/java/org/elasticsearch/index/warmer/WarmerStats.java +++ b/core/src/main/java/org/elasticsearch/index/warmer/WarmerStats.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -104,11 +103,11 @@ public class WarmerStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString WARMER = new XContentBuilderString("warmer"); - static final XContentBuilderString CURRENT = new XContentBuilderString("current"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString TOTAL_TIME = new XContentBuilderString("total_time"); - static final XContentBuilderString TOTAL_TIME_IN_MILLIS = new XContentBuilderString("total_time_in_millis"); + static final String WARMER = "warmer"; + static final String CURRENT = "current"; + static final String TOTAL = "total"; + static final String TOTAL_TIME = "total_time"; + static final String TOTAL_TIME_IN_MILLIS = "total_time_in_millis"; } @Override @@ -124,4 +123,4 @@ public class WarmerStats implements Streamable, ToXContent { out.writeVLong(total); out.writeVLong(totalTimeInMillis); } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/elasticsearch/indices/NodeIndicesStats.java b/core/src/main/java/org/elasticsearch/indices/NodeIndicesStats.java index 237975f2899..f4736f0332e 100644 --- a/core/src/main/java/org/elasticsearch/indices/NodeIndicesStats.java +++ b/core/src/main/java/org/elasticsearch/indices/NodeIndicesStats.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.Index; import org.elasticsearch.index.cache.query.QueryCacheStats; import org.elasticsearch.index.cache.request.RequestCacheStats; @@ -252,6 +251,6 @@ public class NodeIndicesStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); + static final String INDICES = "indices"; } } diff --git a/core/src/main/java/org/elasticsearch/indices/breaker/AllCircuitBreakerStats.java b/core/src/main/java/org/elasticsearch/indices/breaker/AllCircuitBreakerStats.java index 693a6f5b453..09f0cd99001 100644 --- a/core/src/main/java/org/elasticsearch/indices/breaker/AllCircuitBreakerStats.java +++ b/core/src/main/java/org/elasticsearch/indices/breaker/AllCircuitBreakerStats.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -96,6 +95,6 @@ public class AllCircuitBreakerStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString BREAKERS = new XContentBuilderString("breakers"); + static final String BREAKERS = "breakers"; } } diff --git a/core/src/main/java/org/elasticsearch/indices/breaker/CircuitBreakerStats.java b/core/src/main/java/org/elasticsearch/indices/breaker/CircuitBreakerStats.java index 8d3043c9ccc..eca235711bb 100644 --- a/core/src/main/java/org/elasticsearch/indices/breaker/CircuitBreakerStats.java +++ b/core/src/main/java/org/elasticsearch/indices/breaker/CircuitBreakerStats.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Locale; @@ -119,11 +118,11 @@ public class CircuitBreakerStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString LIMIT = new XContentBuilderString("limit_size_in_bytes"); - static final XContentBuilderString LIMIT_HUMAN = new XContentBuilderString("limit_size"); - static final XContentBuilderString ESTIMATED = new XContentBuilderString("estimated_size_in_bytes"); - static final XContentBuilderString ESTIMATED_HUMAN = new XContentBuilderString("estimated_size"); - static final XContentBuilderString OVERHEAD = new XContentBuilderString("overhead"); - static final XContentBuilderString TRIPPED_COUNT = new XContentBuilderString("tripped"); + static final String LIMIT = "limit_size_in_bytes"; + static final String LIMIT_HUMAN = "limit_size"; + static final String ESTIMATED = "estimated_size_in_bytes"; + static final String ESTIMATED_HUMAN = "estimated_size"; + static final String OVERHEAD = "overhead"; + static final String TRIPPED_COUNT = "tripped"; } } diff --git a/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java b/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java index 6eccf8f02db..326f5362b7e 100644 --- a/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java +++ b/core/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.index.shard.ShardId; @@ -348,44 +347,44 @@ public class RecoveryState implements ToXContent, Streamable { } static final class Fields { - static final XContentBuilderString ID = new XContentBuilderString("id"); - static final XContentBuilderString TYPE = new XContentBuilderString("type"); - static final XContentBuilderString STAGE = new XContentBuilderString("stage"); - static final XContentBuilderString PRIMARY = new XContentBuilderString("primary"); - static final XContentBuilderString START_TIME = new XContentBuilderString("start_time"); - static final XContentBuilderString START_TIME_IN_MILLIS = new XContentBuilderString("start_time_in_millis"); - static final XContentBuilderString STOP_TIME = new XContentBuilderString("stop_time"); - static final XContentBuilderString STOP_TIME_IN_MILLIS = new XContentBuilderString("stop_time_in_millis"); - static final XContentBuilderString TOTAL_TIME = new XContentBuilderString("total_time"); - static final XContentBuilderString TOTAL_TIME_IN_MILLIS = new XContentBuilderString("total_time_in_millis"); - static final XContentBuilderString SOURCE = new XContentBuilderString("source"); - static final XContentBuilderString HOST = new XContentBuilderString("host"); - static final XContentBuilderString TRANSPORT_ADDRESS = new XContentBuilderString("transport_address"); - static final XContentBuilderString IP = new XContentBuilderString("ip"); - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString TARGET = new XContentBuilderString("target"); - static final XContentBuilderString INDEX = new XContentBuilderString("index"); - static final XContentBuilderString TRANSLOG = new XContentBuilderString("translog"); - static final XContentBuilderString TOTAL_ON_START = new XContentBuilderString("total_on_start"); - static final XContentBuilderString VERIFY_INDEX = new XContentBuilderString("verify_index"); - static final XContentBuilderString RECOVERED = new XContentBuilderString("recovered"); - static final XContentBuilderString RECOVERED_IN_BYTES = new XContentBuilderString("recovered_in_bytes"); - static final XContentBuilderString CHECK_INDEX_TIME = new XContentBuilderString("check_index_time"); - static final XContentBuilderString CHECK_INDEX_TIME_IN_MILLIS = new XContentBuilderString("check_index_time_in_millis"); - static final XContentBuilderString LENGTH = new XContentBuilderString("length"); - static final XContentBuilderString LENGTH_IN_BYTES = new XContentBuilderString("length_in_bytes"); - static final XContentBuilderString FILES = new XContentBuilderString("files"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString TOTAL_IN_BYTES = new XContentBuilderString("total_in_bytes"); - static final XContentBuilderString REUSED = new XContentBuilderString("reused"); - static final XContentBuilderString REUSED_IN_BYTES = new XContentBuilderString("reused_in_bytes"); - static final XContentBuilderString PERCENT = new XContentBuilderString("percent"); - static final XContentBuilderString DETAILS = new XContentBuilderString("details"); - static final XContentBuilderString SIZE = new XContentBuilderString("size"); - static final XContentBuilderString SOURCE_THROTTLE_TIME = new XContentBuilderString("source_throttle_time"); - static final XContentBuilderString SOURCE_THROTTLE_TIME_IN_MILLIS = new XContentBuilderString("source_throttle_time_in_millis"); - static final XContentBuilderString TARGET_THROTTLE_TIME = new XContentBuilderString("target_throttle_time"); - static final XContentBuilderString TARGET_THROTTLE_TIME_IN_MILLIS = new XContentBuilderString("target_throttle_time_in_millis"); + static final String ID = "id"; + static final String TYPE = "type"; + static final String STAGE = "stage"; + static final String PRIMARY = "primary"; + static final String START_TIME = "start_time"; + static final String START_TIME_IN_MILLIS = "start_time_in_millis"; + static final String STOP_TIME = "stop_time"; + static final String STOP_TIME_IN_MILLIS = "stop_time_in_millis"; + static final String TOTAL_TIME = "total_time"; + static final String TOTAL_TIME_IN_MILLIS = "total_time_in_millis"; + static final String SOURCE = "source"; + static final String HOST = "host"; + static final String TRANSPORT_ADDRESS = "transport_address"; + static final String IP = "ip"; + static final String NAME = "name"; + static final String TARGET = "target"; + static final String INDEX = "index"; + static final String TRANSLOG = "translog"; + static final String TOTAL_ON_START = "total_on_start"; + static final String VERIFY_INDEX = "verify_index"; + static final String RECOVERED = "recovered"; + static final String RECOVERED_IN_BYTES = "recovered_in_bytes"; + static final String CHECK_INDEX_TIME = "check_index_time"; + static final String CHECK_INDEX_TIME_IN_MILLIS = "check_index_time_in_millis"; + static final String LENGTH = "length"; + static final String LENGTH_IN_BYTES = "length_in_bytes"; + static final String FILES = "files"; + static final String TOTAL = "total"; + static final String TOTAL_IN_BYTES = "total_in_bytes"; + static final String REUSED = "reused"; + static final String REUSED_IN_BYTES = "reused_in_bytes"; + static final String PERCENT = "percent"; + static final String DETAILS = "details"; + static final String SIZE = "size"; + static final String SOURCE_THROTTLE_TIME = "source_throttle_time"; + static final String SOURCE_THROTTLE_TIME_IN_MILLIS = "source_throttle_time_in_millis"; + static final String TARGET_THROTTLE_TIME = "target_throttle_time"; + static final String TARGET_THROTTLE_TIME_IN_MILLIS = "target_throttle_time_in_millis"; } public static class Timer implements Streamable { diff --git a/core/src/main/java/org/elasticsearch/monitor/fs/FsInfo.java b/core/src/main/java/org/elasticsearch/monitor/fs/FsInfo.java index 55ce159f397..2ae27b92855 100644 --- a/core/src/main/java/org/elasticsearch/monitor/fs/FsInfo.java +++ b/core/src/main/java/org/elasticsearch/monitor/fs/FsInfo.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Arrays; @@ -150,16 +149,16 @@ public class FsInfo implements Iterable<FsInfo.Path>, Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString PATH = new XContentBuilderString("path"); - static final XContentBuilderString MOUNT = new XContentBuilderString("mount"); - static final XContentBuilderString TYPE = new XContentBuilderString("type"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString TOTAL_IN_BYTES = new XContentBuilderString("total_in_bytes"); - static final XContentBuilderString FREE = new XContentBuilderString("free"); - static final XContentBuilderString FREE_IN_BYTES = new XContentBuilderString("free_in_bytes"); - static final XContentBuilderString AVAILABLE = new XContentBuilderString("available"); - static final XContentBuilderString AVAILABLE_IN_BYTES = new XContentBuilderString("available_in_bytes"); - static final XContentBuilderString SPINS = new XContentBuilderString("spins"); + static final String PATH = "path"; + static final String MOUNT = "mount"; + static final String TYPE = "type"; + static final String TOTAL = "total"; + static final String TOTAL_IN_BYTES = "total_in_bytes"; + static final String FREE = "free"; + static final String FREE_IN_BYTES = "free_in_bytes"; + static final String AVAILABLE = "available"; + static final String AVAILABLE_IN_BYTES = "available_in_bytes"; + static final String SPINS = "spins"; } @Override @@ -263,10 +262,10 @@ public class FsInfo implements Iterable<FsInfo.Path>, Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString FS = new XContentBuilderString("fs"); - static final XContentBuilderString TIMESTAMP = new XContentBuilderString("timestamp"); - static final XContentBuilderString DATA = new XContentBuilderString("data"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); + static final String FS = "fs"; + static final String TIMESTAMP = "timestamp"; + static final String DATA = "data"; + static final String TOTAL = "total"; } @Override diff --git a/core/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java b/core/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java index d35497834f7..3e39edaa47c 100644 --- a/core/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java +++ b/core/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.lang.management.GarbageCollectorMXBean; @@ -359,29 +358,29 @@ public class JvmInfo implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString JVM = new XContentBuilderString("jvm"); - static final XContentBuilderString PID = new XContentBuilderString("pid"); - static final XContentBuilderString VERSION = new XContentBuilderString("version"); - static final XContentBuilderString VM_NAME = new XContentBuilderString("vm_name"); - static final XContentBuilderString VM_VERSION = new XContentBuilderString("vm_version"); - static final XContentBuilderString VM_VENDOR = new XContentBuilderString("vm_vendor"); - static final XContentBuilderString START_TIME = new XContentBuilderString("start_time"); - static final XContentBuilderString START_TIME_IN_MILLIS = new XContentBuilderString("start_time_in_millis"); + static final String JVM = "jvm"; + static final String PID = "pid"; + static final String VERSION = "version"; + static final String VM_NAME = "vm_name"; + static final String VM_VERSION = "vm_version"; + static final String VM_VENDOR = "vm_vendor"; + static final String START_TIME = "start_time"; + static final String START_TIME_IN_MILLIS = "start_time_in_millis"; - static final XContentBuilderString MEM = new XContentBuilderString("mem"); - static final XContentBuilderString HEAP_INIT = new XContentBuilderString("heap_init"); - static final XContentBuilderString HEAP_INIT_IN_BYTES = new XContentBuilderString("heap_init_in_bytes"); - static final XContentBuilderString HEAP_MAX = new XContentBuilderString("heap_max"); - static final XContentBuilderString HEAP_MAX_IN_BYTES = new XContentBuilderString("heap_max_in_bytes"); - static final XContentBuilderString NON_HEAP_INIT = new XContentBuilderString("non_heap_init"); - static final XContentBuilderString NON_HEAP_INIT_IN_BYTES = new XContentBuilderString("non_heap_init_in_bytes"); - static final XContentBuilderString NON_HEAP_MAX = new XContentBuilderString("non_heap_max"); - static final XContentBuilderString NON_HEAP_MAX_IN_BYTES = new XContentBuilderString("non_heap_max_in_bytes"); - static final XContentBuilderString DIRECT_MAX = new XContentBuilderString("direct_max"); - static final XContentBuilderString DIRECT_MAX_IN_BYTES = new XContentBuilderString("direct_max_in_bytes"); - static final XContentBuilderString GC_COLLECTORS = new XContentBuilderString("gc_collectors"); - static final XContentBuilderString MEMORY_POOLS = new XContentBuilderString("memory_pools"); - static final XContentBuilderString USING_COMPRESSED_OOPS = new XContentBuilderString("using_compressed_ordinary_object_pointers"); + static final String MEM = "mem"; + static final String HEAP_INIT = "heap_init"; + static final String HEAP_INIT_IN_BYTES = "heap_init_in_bytes"; + static final String HEAP_MAX = "heap_max"; + static final String HEAP_MAX_IN_BYTES = "heap_max_in_bytes"; + static final String NON_HEAP_INIT = "non_heap_init"; + static final String NON_HEAP_INIT_IN_BYTES = "non_heap_init_in_bytes"; + static final String NON_HEAP_MAX = "non_heap_max"; + static final String NON_HEAP_MAX_IN_BYTES = "non_heap_max_in_bytes"; + static final String DIRECT_MAX = "direct_max"; + static final String DIRECT_MAX_IN_BYTES = "direct_max_in_bytes"; + static final String GC_COLLECTORS = "gc_collectors"; + static final String MEMORY_POOLS = "memory_pools"; + static final String USING_COMPRESSED_OOPS = "using_compressed_ordinary_object_pointers"; } public static JvmInfo readJvmInfo(StreamInput in) throws IOException { diff --git a/core/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java b/core/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java index c78ed608068..43b675f34a2 100644 --- a/core/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java +++ b/core/src/main/java/org/elasticsearch/monitor/jvm/JvmStats.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.lang.management.BufferPoolMXBean; @@ -254,54 +253,54 @@ public class JvmStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString JVM = new XContentBuilderString("jvm"); - static final XContentBuilderString TIMESTAMP = new XContentBuilderString("timestamp"); - static final XContentBuilderString UPTIME = new XContentBuilderString("uptime"); - static final XContentBuilderString UPTIME_IN_MILLIS = new XContentBuilderString("uptime_in_millis"); + static final String JVM = "jvm"; + static final String TIMESTAMP = "timestamp"; + static final String UPTIME = "uptime"; + static final String UPTIME_IN_MILLIS = "uptime_in_millis"; - static final XContentBuilderString MEM = new XContentBuilderString("mem"); - static final XContentBuilderString HEAP_USED = new XContentBuilderString("heap_used"); - static final XContentBuilderString HEAP_USED_IN_BYTES = new XContentBuilderString("heap_used_in_bytes"); - static final XContentBuilderString HEAP_USED_PERCENT = new XContentBuilderString("heap_used_percent"); - static final XContentBuilderString HEAP_MAX = new XContentBuilderString("heap_max"); - static final XContentBuilderString HEAP_MAX_IN_BYTES = new XContentBuilderString("heap_max_in_bytes"); - static final XContentBuilderString HEAP_COMMITTED = new XContentBuilderString("heap_committed"); - static final XContentBuilderString HEAP_COMMITTED_IN_BYTES = new XContentBuilderString("heap_committed_in_bytes"); + static final String MEM = "mem"; + static final String HEAP_USED = "heap_used"; + static final String HEAP_USED_IN_BYTES = "heap_used_in_bytes"; + static final String HEAP_USED_PERCENT = "heap_used_percent"; + static final String HEAP_MAX = "heap_max"; + static final String HEAP_MAX_IN_BYTES = "heap_max_in_bytes"; + static final String HEAP_COMMITTED = "heap_committed"; + static final String HEAP_COMMITTED_IN_BYTES = "heap_committed_in_bytes"; - static final XContentBuilderString NON_HEAP_USED = new XContentBuilderString("non_heap_used"); - static final XContentBuilderString NON_HEAP_USED_IN_BYTES = new XContentBuilderString("non_heap_used_in_bytes"); - static final XContentBuilderString NON_HEAP_COMMITTED = new XContentBuilderString("non_heap_committed"); - static final XContentBuilderString NON_HEAP_COMMITTED_IN_BYTES = new XContentBuilderString("non_heap_committed_in_bytes"); + static final String NON_HEAP_USED = "non_heap_used"; + static final String NON_HEAP_USED_IN_BYTES = "non_heap_used_in_bytes"; + static final String NON_HEAP_COMMITTED = "non_heap_committed"; + static final String NON_HEAP_COMMITTED_IN_BYTES = "non_heap_committed_in_bytes"; - static final XContentBuilderString POOLS = new XContentBuilderString("pools"); - static final XContentBuilderString USED = new XContentBuilderString("used"); - static final XContentBuilderString USED_IN_BYTES = new XContentBuilderString("used_in_bytes"); - static final XContentBuilderString MAX = new XContentBuilderString("max"); - static final XContentBuilderString MAX_IN_BYTES = new XContentBuilderString("max_in_bytes"); - static final XContentBuilderString PEAK_USED = new XContentBuilderString("peak_used"); - static final XContentBuilderString PEAK_USED_IN_BYTES = new XContentBuilderString("peak_used_in_bytes"); - static final XContentBuilderString PEAK_MAX = new XContentBuilderString("peak_max"); - static final XContentBuilderString PEAK_MAX_IN_BYTES = new XContentBuilderString("peak_max_in_bytes"); + static final String POOLS = "pools"; + static final String USED = "used"; + static final String USED_IN_BYTES = "used_in_bytes"; + static final String MAX = "max"; + static final String MAX_IN_BYTES = "max_in_bytes"; + static final String PEAK_USED = "peak_used"; + static final String PEAK_USED_IN_BYTES = "peak_used_in_bytes"; + static final String PEAK_MAX = "peak_max"; + static final String PEAK_MAX_IN_BYTES = "peak_max_in_bytes"; - static final XContentBuilderString THREADS = new XContentBuilderString("threads"); - static final XContentBuilderString COUNT = new XContentBuilderString("count"); - static final XContentBuilderString PEAK_COUNT = new XContentBuilderString("peak_count"); + static final String THREADS = "threads"; + static final String COUNT = "count"; + static final String PEAK_COUNT = "peak_count"; - static final XContentBuilderString GC = new XContentBuilderString("gc"); - static final XContentBuilderString COLLECTORS = new XContentBuilderString("collectors"); - static final XContentBuilderString COLLECTION_COUNT = new XContentBuilderString("collection_count"); - static final XContentBuilderString COLLECTION_TIME = new XContentBuilderString("collection_time"); - static final XContentBuilderString COLLECTION_TIME_IN_MILLIS = new XContentBuilderString("collection_time_in_millis"); + static final String GC = "gc"; + static final String COLLECTORS = "collectors"; + static final String COLLECTION_COUNT = "collection_count"; + static final String COLLECTION_TIME = "collection_time"; + static final String COLLECTION_TIME_IN_MILLIS = "collection_time_in_millis"; - static final XContentBuilderString BUFFER_POOLS = new XContentBuilderString("buffer_pools"); - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString TOTAL_CAPACITY = new XContentBuilderString("total_capacity"); - static final XContentBuilderString TOTAL_CAPACITY_IN_BYTES = new XContentBuilderString("total_capacity_in_bytes"); + static final String BUFFER_POOLS = "buffer_pools"; + static final String NAME = "name"; + static final String TOTAL_CAPACITY = "total_capacity"; + static final String TOTAL_CAPACITY_IN_BYTES = "total_capacity_in_bytes"; - static final XContentBuilderString CLASSES = new XContentBuilderString("classes"); - static final XContentBuilderString CURRENT_LOADED_COUNT = new XContentBuilderString("current_loaded_count"); - static final XContentBuilderString TOTAL_LOADED_COUNT = new XContentBuilderString("total_loaded_count"); - static final XContentBuilderString TOTAL_UNLOADED_COUNT = new XContentBuilderString("total_unloaded_count"); + static final String CLASSES = "classes"; + static final String CURRENT_LOADED_COUNT = "current_loaded_count"; + static final String TOTAL_LOADED_COUNT = "total_loaded_count"; + static final String TOTAL_UNLOADED_COUNT = "total_unloaded_count"; } diff --git a/core/src/main/java/org/elasticsearch/monitor/os/OsInfo.java b/core/src/main/java/org/elasticsearch/monitor/os/OsInfo.java index d94447221c3..f0520358524 100644 --- a/core/src/main/java/org/elasticsearch/monitor/os/OsInfo.java +++ b/core/src/main/java/org/elasticsearch/monitor/os/OsInfo.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -68,14 +67,14 @@ public class OsInfo implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString OS = new XContentBuilderString("os"); - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString ARCH = new XContentBuilderString("arch"); - static final XContentBuilderString VERSION = new XContentBuilderString("version"); - static final XContentBuilderString REFRESH_INTERVAL = new XContentBuilderString("refresh_interval"); - static final XContentBuilderString REFRESH_INTERVAL_IN_MILLIS = new XContentBuilderString("refresh_interval_in_millis"); - static final XContentBuilderString AVAILABLE_PROCESSORS = new XContentBuilderString("available_processors"); - static final XContentBuilderString ALLOCATED_PROCESSORS = new XContentBuilderString("allocated_processors"); + static final String OS = "os"; + static final String NAME = "name"; + static final String ARCH = "arch"; + static final String VERSION = "version"; + static final String REFRESH_INTERVAL = "refresh_interval"; + static final String REFRESH_INTERVAL_IN_MILLIS = "refresh_interval_in_millis"; + static final String AVAILABLE_PROCESSORS = "available_processors"; + static final String ALLOCATED_PROCESSORS = "allocated_processors"; } @Override diff --git a/core/src/main/java/org/elasticsearch/monitor/os/OsStats.java b/core/src/main/java/org/elasticsearch/monitor/os/OsStats.java index 569f8825aa9..51302d7ae6b 100644 --- a/core/src/main/java/org/elasticsearch/monitor/os/OsStats.java +++ b/core/src/main/java/org/elasticsearch/monitor/os/OsStats.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.Arrays; @@ -61,26 +60,26 @@ public class OsStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString OS = new XContentBuilderString("os"); - static final XContentBuilderString TIMESTAMP = new XContentBuilderString("timestamp"); - static final XContentBuilderString CPU = new XContentBuilderString("cpu"); - static final XContentBuilderString PERCENT = new XContentBuilderString("percent"); - static final XContentBuilderString LOAD_AVERAGE = new XContentBuilderString("load_average"); - static final XContentBuilderString LOAD_AVERAGE_1M = new XContentBuilderString("1m"); - static final XContentBuilderString LOAD_AVERAGE_5M = new XContentBuilderString("5m"); - static final XContentBuilderString LOAD_AVERAGE_15M = new XContentBuilderString("15m"); + static final String OS = "os"; + static final String TIMESTAMP = "timestamp"; + static final String CPU = "cpu"; + static final String PERCENT = "percent"; + static final String LOAD_AVERAGE = "load_average"; + static final String LOAD_AVERAGE_1M = new String("1m"); + static final String LOAD_AVERAGE_5M = new String("5m"); + static final String LOAD_AVERAGE_15M = new String("15m"); - static final XContentBuilderString MEM = new XContentBuilderString("mem"); - static final XContentBuilderString SWAP = new XContentBuilderString("swap"); - static final XContentBuilderString FREE = new XContentBuilderString("free"); - static final XContentBuilderString FREE_IN_BYTES = new XContentBuilderString("free_in_bytes"); - static final XContentBuilderString USED = new XContentBuilderString("used"); - static final XContentBuilderString USED_IN_BYTES = new XContentBuilderString("used_in_bytes"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString TOTAL_IN_BYTES = new XContentBuilderString("total_in_bytes"); + static final String MEM = "mem"; + static final String SWAP = "swap"; + static final String FREE = "free"; + static final String FREE_IN_BYTES = "free_in_bytes"; + static final String USED = "used"; + static final String USED_IN_BYTES = "used_in_bytes"; + static final String TOTAL = "total"; + static final String TOTAL_IN_BYTES = "total_in_bytes"; - static final XContentBuilderString FREE_PERCENT = new XContentBuilderString("free_percent"); - static final XContentBuilderString USED_PERCENT = new XContentBuilderString("used_percent"); + static final String FREE_PERCENT = "free_percent"; + static final String USED_PERCENT = "used_percent"; } @Override diff --git a/core/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java b/core/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java index 7d1ea03b085..cf9c9e63b87 100644 --- a/core/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java +++ b/core/src/main/java/org/elasticsearch/monitor/process/ProcessInfo.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -64,11 +63,11 @@ public class ProcessInfo implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString PROCESS = new XContentBuilderString("process"); - static final XContentBuilderString REFRESH_INTERVAL = new XContentBuilderString("refresh_interval"); - static final XContentBuilderString REFRESH_INTERVAL_IN_MILLIS = new XContentBuilderString("refresh_interval_in_millis"); - static final XContentBuilderString ID = new XContentBuilderString("id"); - static final XContentBuilderString MLOCKALL = new XContentBuilderString("mlockall"); + static final String PROCESS = "process"; + static final String REFRESH_INTERVAL = "refresh_interval"; + static final String REFRESH_INTERVAL_IN_MILLIS = "refresh_interval_in_millis"; + static final String ID = "id"; + static final String MLOCKALL = "mlockall"; } @Override diff --git a/core/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java b/core/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java index de447c98748..310cb215ae5 100644 --- a/core/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java +++ b/core/src/main/java/org/elasticsearch/monitor/process/ProcessStats.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -65,19 +64,19 @@ public class ProcessStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString PROCESS = new XContentBuilderString("process"); - static final XContentBuilderString TIMESTAMP = new XContentBuilderString("timestamp"); - static final XContentBuilderString OPEN_FILE_DESCRIPTORS = new XContentBuilderString("open_file_descriptors"); - static final XContentBuilderString MAX_FILE_DESCRIPTORS = new XContentBuilderString("max_file_descriptors"); + static final String PROCESS = "process"; + static final String TIMESTAMP = "timestamp"; + static final String OPEN_FILE_DESCRIPTORS = "open_file_descriptors"; + static final String MAX_FILE_DESCRIPTORS = "max_file_descriptors"; - static final XContentBuilderString CPU = new XContentBuilderString("cpu"); - static final XContentBuilderString PERCENT = new XContentBuilderString("percent"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString TOTAL_IN_MILLIS = new XContentBuilderString("total_in_millis"); + static final String CPU = "cpu"; + static final String PERCENT = "percent"; + static final String TOTAL = "total"; + static final String TOTAL_IN_MILLIS = "total_in_millis"; - static final XContentBuilderString MEM = new XContentBuilderString("mem"); - static final XContentBuilderString TOTAL_VIRTUAL = new XContentBuilderString("total_virtual"); - static final XContentBuilderString TOTAL_VIRTUAL_IN_BYTES = new XContentBuilderString("total_virtual_in_bytes"); + static final String MEM = "mem"; + static final String TOTAL_VIRTUAL = "total_virtual"; + static final String TOTAL_VIRTUAL_IN_BYTES = "total_virtual_in_bytes"; } @Override diff --git a/core/src/main/java/org/elasticsearch/plugins/PluginInfo.java b/core/src/main/java/org/elasticsearch/plugins/PluginInfo.java index bd063b3312c..500861d8999 100644 --- a/core/src/main/java/org/elasticsearch/plugins/PluginInfo.java +++ b/core/src/main/java/org/elasticsearch/plugins/PluginInfo.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.io.InputStream; @@ -39,11 +38,11 @@ public class PluginInfo implements Streamable, ToXContent { public static final String ES_PLUGIN_POLICY = "plugin-security.policy"; static final class Fields { - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString DESCRIPTION = new XContentBuilderString("description"); - static final XContentBuilderString URL = new XContentBuilderString("url"); - static final XContentBuilderString VERSION = new XContentBuilderString("version"); - static final XContentBuilderString CLASSNAME = new XContentBuilderString("classname"); + static final String NAME = "name"; + static final String DESCRIPTION = "description"; + static final String URL = "url"; + static final String VERSION = "version"; + static final String CLASSNAME = "classname"; } private String name; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java index 720d19a7fe4..edce416072e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; @@ -98,6 +97,6 @@ public class RestClusterStateAction extends BaseRestHandler { } static final class Fields { - static final XContentBuilderString CLUSTER_NAME = new XContentBuilderString("cluster_name"); + static final String CLUSTER_NAME = "cluster_name"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java index d18b013efb2..cbebf08516d 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; @@ -113,7 +112,7 @@ public class RestGetAliasesAction extends BaseRestHandler { static class Fields { - static final XContentBuilderString ALIASES = new XContentBuilderString("aliases"); + static final String ALIASES = "aliases"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java index 4c307f4ba0e..f31c17d8b6e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java @@ -34,7 +34,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.xcontent.ToXContent.Params; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; @@ -155,9 +154,9 @@ public class RestGetIndicesAction extends BaseRestHandler { } static class Fields { - static final XContentBuilderString ALIASES = new XContentBuilderString("aliases"); - static final XContentBuilderString MAPPINGS = new XContentBuilderString("mappings"); - static final XContentBuilderString SETTINGS = new XContentBuilderString("settings"); + static final String ALIASES = "aliases"; + static final String MAPPINGS = "mappings"; + static final String SETTINGS = "settings"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java index 29012ba86fe..0da54bc4e75 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.indices.TypeMissingException; @@ -105,6 +104,6 @@ public class RestGetMappingAction extends BaseRestHandler { } static class Fields { - static final XContentBuilderString MAPPINGS = new XContentBuilderString("mappings"); + static final String MAPPINGS = "mappings"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java index c0a209375b0..4ff7234b2ef 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java @@ -29,7 +29,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.indices.query.IndicesQueriesRegistry; import org.elasticsearch.rest.BaseRestHandler; @@ -131,9 +130,9 @@ public class RestValidateQueryAction extends BaseRestHandler { return new BytesRestResponse(OK, builder); } - private static final XContentBuilderString INDEX_FIELD = new XContentBuilderString("index"); - private static final XContentBuilderString VALID_FIELD = new XContentBuilderString("valid"); - private static final XContentBuilderString EXPLANATIONS_FIELD = new XContentBuilderString("explanations"); - private static final XContentBuilderString ERROR_FIELD = new XContentBuilderString("error"); - private static final XContentBuilderString EXPLANATION_FIELD = new XContentBuilderString("explanation"); + private static final String INDEX_FIELD = "index"; + private static final String VALID_FIELD = "valid"; + private static final String EXPLANATIONS_FIELD = "explanations"; + private static final String ERROR_FIELD = "error"; + private static final String EXPLANATION_FIELD = "explanation"; } diff --git a/core/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java b/core/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java index 4c8d3a85989..620418eb087 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java @@ -30,7 +30,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; @@ -112,10 +111,10 @@ public class RestBulkAction extends BaseRestHandler { } static final class Fields { - static final XContentBuilderString ITEMS = new XContentBuilderString("items"); - static final XContentBuilderString ERRORS = new XContentBuilderString("errors"); - static final XContentBuilderString TOOK = new XContentBuilderString("took"); - static final XContentBuilderString INGEST_TOOK = new XContentBuilderString("ingest_took"); + static final String ITEMS = "items"; + static final String ERRORS = "errors"; + static final String TOOK = "took"; + static final String INGEST_TOOK = "ingest_took"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java b/core/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java index 864cddc4ba0..a1fdc13437c 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java @@ -28,7 +28,6 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.get.GetResult; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.indices.query.IndicesQueriesRegistry; @@ -131,15 +130,15 @@ public class RestExplainAction extends BaseRestHandler { } static class Fields { - static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - static final XContentBuilderString _TYPE = new XContentBuilderString("_type"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); - static final XContentBuilderString MATCHED = new XContentBuilderString("matched"); - static final XContentBuilderString EXPLANATION = new XContentBuilderString("explanation"); - static final XContentBuilderString VALUE = new XContentBuilderString("value"); - static final XContentBuilderString DESCRIPTION = new XContentBuilderString("description"); - static final XContentBuilderString DETAILS = new XContentBuilderString("details"); - static final XContentBuilderString GET = new XContentBuilderString("get"); + static final String _INDEX = "_index"; + static final String _TYPE = "_type"; + static final String _ID = "_id"; + static final String MATCHED = "matched"; + static final String EXPLANATION = "explanation"; + static final String VALUE = "value"; + static final String DESCRIPTION = "description"; + static final String DETAILS = "details"; + static final String GET = "get"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/script/RestDeleteIndexedScriptAction.java b/core/src/main/java/org/elasticsearch/rest/action/script/RestDeleteIndexedScriptAction.java index 9009025d3a9..ce4cb9c057a 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/script/RestDeleteIndexedScriptAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/script/RestDeleteIndexedScriptAction.java @@ -24,7 +24,6 @@ import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; @@ -82,10 +81,10 @@ public class RestDeleteIndexedScriptAction extends BaseRestHandler { } static final class Fields { - static final XContentBuilderString FOUND = new XContentBuilderString("found"); - static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - static final XContentBuilderString _TYPE = new XContentBuilderString("_type"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); - static final XContentBuilderString _VERSION = new XContentBuilderString("_version"); + static final String FOUND = "found"; + static final String _INDEX = "_index"; + static final String _TYPE = "_type"; + static final String _ID = "_id"; + static final String _VERSION = "_version"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/script/RestGetIndexedScriptAction.java b/core/src/main/java/org/elasticsearch/rest/action/script/RestGetIndexedScriptAction.java index e2c4ff6373d..0ed1c309bc5 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/script/RestGetIndexedScriptAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/script/RestGetIndexedScriptAction.java @@ -24,7 +24,6 @@ import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; @@ -54,7 +53,7 @@ public class RestGetIndexedScriptAction extends BaseRestHandler { } } - protected XContentBuilderString getScriptFieldName() { + protected String getScriptFieldName() { return Fields.SCRIPT; } @@ -87,10 +86,10 @@ public class RestGetIndexedScriptAction extends BaseRestHandler { } private static final class Fields { - private static final XContentBuilderString SCRIPT = new XContentBuilderString("script"); - private static final XContentBuilderString LANG = new XContentBuilderString("lang"); - private static final XContentBuilderString _ID = new XContentBuilderString("_id"); - private static final XContentBuilderString _VERSION = new XContentBuilderString("_version"); - private static final XContentBuilderString FOUND = new XContentBuilderString("found"); + private static final String SCRIPT = "script"; + private static final String LANG = "lang"; + private static final String _ID = "_id"; + private static final String _VERSION = "_version"; + private static final String FOUND = "found"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/script/RestPutIndexedScriptAction.java b/core/src/main/java/org/elasticsearch/rest/action/script/RestPutIndexedScriptAction.java index f5a6f67517e..b0f1842d98a 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/script/RestPutIndexedScriptAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/script/RestPutIndexedScriptAction.java @@ -25,7 +25,6 @@ import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.VersionType; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; @@ -121,8 +120,8 @@ public class RestPutIndexedScriptAction extends BaseRestHandler { } static final class Fields { - static final XContentBuilderString _VERSION = new XContentBuilderString("_version"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); - static final XContentBuilderString CREATED = new XContentBuilderString("created"); + static final String _VERSION = "_version"; + static final String _ID = "_id"; + static final String CREATED = "created"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/AcknowledgedRestListener.java b/core/src/main/java/org/elasticsearch/rest/action/support/AcknowledgedRestListener.java index a59dc3d47b8..2f5223d91df 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/AcknowledgedRestListener.java +++ b/core/src/main/java/org/elasticsearch/rest/action/support/AcknowledgedRestListener.java @@ -20,7 +20,6 @@ package org.elasticsearch.rest.action.support; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestResponse; @@ -55,6 +54,6 @@ public class AcknowledgedRestListener<T extends AcknowledgedResponse> extends Re } static final class Fields { - static final XContentBuilderString ACKNOWLEDGED = new XContentBuilderString("acknowledged"); + static final String ACKNOWLEDGED = "acknowledged"; } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/RestActions.java b/core/src/main/java/org/elasticsearch/rest/action/support/RestActions.java index 004f67a9dba..9ab523ba1e6 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/RestActions.java +++ b/core/src/main/java/org/elasticsearch/rest/action/support/RestActions.java @@ -29,7 +29,6 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.lucene.uid.Versions; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; @@ -65,11 +64,11 @@ public class RestActions { } static final class Fields { - static final XContentBuilderString _SHARDS = new XContentBuilderString("_shards"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString SUCCESSFUL = new XContentBuilderString("successful"); - static final XContentBuilderString FAILED = new XContentBuilderString("failed"); - static final XContentBuilderString FAILURES = new XContentBuilderString("failures"); + static final String _SHARDS = "_shards"; + static final String TOTAL = "total"; + static final String SUCCESSFUL = "successful"; + static final String FAILED = "failed"; + static final String FAILURES = "failures"; } public static void buildBroadcastShardsHeader(XContentBuilder builder, ToXContent.Params params, BroadcastResponse response) throws IOException { diff --git a/core/src/main/java/org/elasticsearch/rest/action/template/RestGetSearchTemplateAction.java b/core/src/main/java/org/elasticsearch/rest/action/template/RestGetSearchTemplateAction.java index 0e8aa357fcd..4c25d6166e0 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/template/RestGetSearchTemplateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/template/RestGetSearchTemplateAction.java @@ -21,7 +21,6 @@ package org.elasticsearch.rest.action.template; import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.script.RestGetIndexedScriptAction; @@ -46,9 +45,9 @@ public class RestGetSearchTemplateAction extends RestGetIndexedScriptAction { } @Override - protected XContentBuilderString getScriptFieldName() { + protected String getScriptFieldName() { return TEMPLATE; } - private static final XContentBuilderString TEMPLATE = new XContentBuilderString("template"); + private static final String TEMPLATE = "template"; } diff --git a/core/src/main/java/org/elasticsearch/script/ScriptStats.java b/core/src/main/java/org/elasticsearch/script/ScriptStats.java index 0bad4b27de0..c08d220d572 100644 --- a/core/src/main/java/org/elasticsearch/script/ScriptStats.java +++ b/core/src/main/java/org/elasticsearch/script/ScriptStats.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -75,8 +74,8 @@ public class ScriptStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString SCRIPT_STATS = new XContentBuilderString("script"); - static final XContentBuilderString COMPILATIONS = new XContentBuilderString("compilations"); - static final XContentBuilderString CACHE_EVICTIONS = new XContentBuilderString("cache_evictions"); + static final String SCRIPT_STATS = "script"; + static final String COMPILATIONS = "compilations"; + static final String CACHE_EVICTIONS = "cache_evictions"; } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/InternalAggregation.java b/core/src/main/java/org/elasticsearch/search/aggregations/InternalAggregation.java index 04b1026446f..744840b2adf 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/InternalAggregation.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/InternalAggregation.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.script.ScriptService; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregatorStreams; @@ -243,18 +242,18 @@ public abstract class InternalAggregation implements Aggregation, ToXContent, St * Common xcontent fields that are shared among addAggregation */ public static final class CommonFields { - public static final XContentBuilderString META = new XContentBuilderString("meta"); - public static final XContentBuilderString BUCKETS = new XContentBuilderString("buckets"); - public static final XContentBuilderString VALUE = new XContentBuilderString("value"); - public static final XContentBuilderString VALUES = new XContentBuilderString("values"); - public static final XContentBuilderString VALUE_AS_STRING = new XContentBuilderString("value_as_string"); - public static final XContentBuilderString DOC_COUNT = new XContentBuilderString("doc_count"); - public static final XContentBuilderString KEY = new XContentBuilderString("key"); - public static final XContentBuilderString KEY_AS_STRING = new XContentBuilderString("key_as_string"); - public static final XContentBuilderString FROM = new XContentBuilderString("from"); - public static final XContentBuilderString FROM_AS_STRING = new XContentBuilderString("from_as_string"); - public static final XContentBuilderString TO = new XContentBuilderString("to"); - public static final XContentBuilderString TO_AS_STRING = new XContentBuilderString("to_as_string"); + public static final String META = "meta"; + public static final String BUCKETS = "buckets"; + public static final String VALUE = "value"; + public static final String VALUES = "values"; + public static final String VALUE_AS_STRING = "value_as_string"; + public static final String DOC_COUNT = "doc_count"; + public static final String KEY = "key"; + public static final String KEY_AS_STRING = "key_as_string"; + public static final String FROM = "from"; + public static final String FROM_AS_STRING = "from_as_string"; + public static final String TO = "to"; + public static final String TO_AS_STRING = "to_as_string"; } } diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/InternalAggregations.java b/core/src/main/java/org/elasticsearch/search/aggregations/InternalAggregations.java index 9b23997b6d4..357886a69f6 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/InternalAggregations.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/InternalAggregations.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.search.aggregations.InternalAggregation.ReduceContext; import org.elasticsearch.search.aggregations.support.AggregationPath; @@ -164,7 +163,7 @@ public class InternalAggregations implements Aggregations, ToXContent, Streamabl /** The fields required to write this addAggregation to xcontent */ static class Fields { - public static final XContentBuilderString AGGREGATIONS = new XContentBuilderString("aggregations"); + public static final String AGGREGATIONS = "aggregations"; } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/InternalGeoCentroid.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/InternalGeoCentroid.java index 77d357352af..2798169b699 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/InternalGeoCentroid.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/geocentroid/InternalGeoCentroid.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.search.aggregations.AggregationStreams; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.metrics.InternalMetricsAggregation; @@ -147,7 +146,7 @@ public class InternalGeoCentroid extends InternalMetricsAggregation implements G } static class Fields { - public static final XContentBuilderString CENTROID = new XContentBuilderString("location"); + public static final String CENTROID = "location"; } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/InternalStats.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/InternalStats.java index ce8a492f3a3..6b98201898b 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/InternalStats.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/InternalStats.java @@ -21,7 +21,6 @@ package org.elasticsearch.search.aggregations.metrics.stats; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.AggregationStreams; import org.elasticsearch.search.aggregations.InternalAggregation; @@ -191,15 +190,15 @@ public class InternalStats extends InternalNumericMetricsAggregation.MultiValue } static class Fields { - public static final XContentBuilderString COUNT = new XContentBuilderString("count"); - public static final XContentBuilderString MIN = new XContentBuilderString("min"); - public static final XContentBuilderString MIN_AS_STRING = new XContentBuilderString("min_as_string"); - public static final XContentBuilderString MAX = new XContentBuilderString("max"); - public static final XContentBuilderString MAX_AS_STRING = new XContentBuilderString("max_as_string"); - public static final XContentBuilderString AVG = new XContentBuilderString("avg"); - public static final XContentBuilderString AVG_AS_STRING = new XContentBuilderString("avg_as_string"); - public static final XContentBuilderString SUM = new XContentBuilderString("sum"); - public static final XContentBuilderString SUM_AS_STRING = new XContentBuilderString("sum_as_string"); + public static final String COUNT = "count"; + public static final String MIN = "min"; + public static final String MIN_AS_STRING = "min_as_string"; + public static final String MAX = "max"; + public static final String MAX_AS_STRING = "max_as_string"; + public static final String AVG = "avg"; + public static final String AVG_AS_STRING = "avg_as_string"; + public static final String SUM = "sum"; + public static final String SUM_AS_STRING = "sum_as_string"; } @Override diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/InternalExtendedStats.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/InternalExtendedStats.java index d2cb2fb8a51..eff72797b58 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/InternalExtendedStats.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/stats/extended/InternalExtendedStats.java @@ -22,7 +22,6 @@ import org.elasticsearch.Version; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.AggregationStreams; import org.elasticsearch.search.aggregations.InternalAggregation; @@ -172,16 +171,16 @@ public class InternalExtendedStats extends InternalStats implements ExtendedStat static class Fields { - public static final XContentBuilderString SUM_OF_SQRS = new XContentBuilderString("sum_of_squares"); - public static final XContentBuilderString SUM_OF_SQRS_AS_STRING = new XContentBuilderString("sum_of_squares_as_string"); - public static final XContentBuilderString VARIANCE = new XContentBuilderString("variance"); - public static final XContentBuilderString VARIANCE_AS_STRING = new XContentBuilderString("variance_as_string"); - public static final XContentBuilderString STD_DEVIATION = new XContentBuilderString("std_deviation"); - public static final XContentBuilderString STD_DEVIATION_AS_STRING = new XContentBuilderString("std_deviation_as_string"); - public static final XContentBuilderString STD_DEVIATION_BOUNDS = new XContentBuilderString("std_deviation_bounds"); - public static final XContentBuilderString STD_DEVIATION_BOUNDS_AS_STRING = new XContentBuilderString("std_deviation_bounds_as_string"); - public static final XContentBuilderString UPPER = new XContentBuilderString("upper"); - public static final XContentBuilderString LOWER = new XContentBuilderString("lower"); + public static final String SUM_OF_SQRS = "sum_of_squares"; + public static final String SUM_OF_SQRS_AS_STRING = "sum_of_squares_as_string"; + public static final String VARIANCE = "variance"; + public static final String VARIANCE_AS_STRING = "variance_as_string"; + public static final String STD_DEVIATION = "std_deviation"; + public static final String STD_DEVIATION_AS_STRING = "std_deviation_as_string"; + public static final String STD_DEVIATION_BOUNDS = "std_deviation_bounds"; + public static final String STD_DEVIATION_BOUNDS_AS_STRING = "std_deviation_bounds_as_string"; + public static final String UPPER = "upper"; + public static final String LOWER = "lower"; } diff --git a/core/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java b/core/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java index 4d232f507fa..628f409974e 100644 --- a/core/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java +++ b/core/src/main/java/org/elasticsearch/search/internal/InternalSearchHit.java @@ -33,7 +33,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.text.Text; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHitField; @@ -407,20 +406,20 @@ public class InternalSearchHit implements SearchHit { } public static class Fields { - static final XContentBuilderString _INDEX = new XContentBuilderString("_index"); - static final XContentBuilderString _TYPE = new XContentBuilderString("_type"); - static final XContentBuilderString _ID = new XContentBuilderString("_id"); - static final XContentBuilderString _VERSION = new XContentBuilderString("_version"); - static final XContentBuilderString _SCORE = new XContentBuilderString("_score"); - static final XContentBuilderString FIELDS = new XContentBuilderString("fields"); - static final XContentBuilderString HIGHLIGHT = new XContentBuilderString("highlight"); - static final XContentBuilderString SORT = new XContentBuilderString("sort"); - static final XContentBuilderString MATCHED_QUERIES = new XContentBuilderString("matched_queries"); - static final XContentBuilderString _EXPLANATION = new XContentBuilderString("_explanation"); - static final XContentBuilderString VALUE = new XContentBuilderString("value"); - static final XContentBuilderString DESCRIPTION = new XContentBuilderString("description"); - static final XContentBuilderString DETAILS = new XContentBuilderString("details"); - static final XContentBuilderString INNER_HITS = new XContentBuilderString("inner_hits"); + static final String _INDEX = "_index"; + static final String _TYPE = "_type"; + static final String _ID = "_id"; + static final String _VERSION = "_version"; + static final String _SCORE = "_score"; + static final String FIELDS = "fields"; + static final String HIGHLIGHT = "highlight"; + static final String SORT = "sort"; + static final String MATCHED_QUERIES = "matched_queries"; + static final String _EXPLANATION = "_explanation"; + static final String VALUE = "value"; + static final String DESCRIPTION = "description"; + static final String DETAILS = "details"; + static final String INNER_HITS = "inner_hits"; } @Override @@ -836,9 +835,9 @@ public class InternalSearchHit implements SearchHit { public static class Fields { - static final XContentBuilderString _NESTED = new XContentBuilderString("_nested"); - static final XContentBuilderString _NESTED_FIELD = new XContentBuilderString("field"); - static final XContentBuilderString _NESTED_OFFSET = new XContentBuilderString("offset"); + static final String _NESTED = "_nested"; + static final String _NESTED_FIELD = "field"; + static final String _NESTED_OFFSET = "offset"; } } diff --git a/core/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java b/core/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java index 09d11e1a1a3..592d4b0751e 100644 --- a/core/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java +++ b/core/src/main/java/org/elasticsearch/search/internal/InternalSearchHits.java @@ -23,7 +23,6 @@ import com.carrotsearch.hppc.IntObjectHashMap; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHits; import org.elasticsearch.search.SearchShardTarget; @@ -163,9 +162,9 @@ public class InternalSearchHits implements SearchHits { } static final class Fields { - static final XContentBuilderString HITS = new XContentBuilderString("hits"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString MAX_SCORE = new XContentBuilderString("max_score"); + static final String HITS = "hits"; + static final String TOTAL = "total"; + static final String MAX_SCORE = "max_score"; } @Override diff --git a/core/src/main/java/org/elasticsearch/search/suggest/Suggest.java b/core/src/main/java/org/elasticsearch/search/suggest/Suggest.java index 926ebaf35b0..35f70abf2cc 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/Suggest.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/Suggest.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.text.Text; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.search.suggest.Suggest.Suggestion.Entry; import org.elasticsearch.search.suggest.Suggest.Suggestion.Entry.Option; @@ -47,7 +46,7 @@ import java.util.Map; */ public class Suggest implements Iterable<Suggest.Suggestion<? extends Entry<? extends Option>>>, Streamable, ToXContent { - private static final XContentBuilderString NAME = new XContentBuilderString("suggest"); + private static final String NAME = "suggest"; private static final Comparator<Option> COMPARATOR = new Comparator<Suggest.Suggestion.Entry.Option>() { @Override @@ -327,10 +326,10 @@ public class Suggest implements Iterable<Suggest.Suggestion<? extends Entry<? ex static class Fields { - static final XContentBuilderString TEXT = new XContentBuilderString("text"); - static final XContentBuilderString OFFSET = new XContentBuilderString("offset"); - static final XContentBuilderString LENGTH = new XContentBuilderString("length"); - static final XContentBuilderString OPTIONS = new XContentBuilderString("options"); + static final String TEXT = "text"; + static final String OFFSET = "offset"; + static final String LENGTH = "length"; + static final String OPTIONS = "options"; } @@ -510,10 +509,10 @@ public class Suggest implements Iterable<Suggest.Suggestion<? extends Entry<? ex static class Fields { - static final XContentBuilderString TEXT = new XContentBuilderString("text"); - static final XContentBuilderString HIGHLIGHTED = new XContentBuilderString("highlighted"); - static final XContentBuilderString SCORE = new XContentBuilderString("score"); - static final XContentBuilderString COLLATE_MATCH = new XContentBuilderString("collate_match"); + static final String TEXT = "text"; + static final String HIGHLIGHTED = "highlighted"; + static final String SCORE = "score"; + static final String COLLATE_MATCH = "collate_match"; } diff --git a/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionStats.java b/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionStats.java index 7bb96aeedca..c8ed562f9cc 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionStats.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/completion/CompletionStats.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -123,10 +122,10 @@ public class CompletionStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString COMPLETION = new XContentBuilderString("completion"); - static final XContentBuilderString SIZE_IN_BYTES = new XContentBuilderString("size_in_bytes"); - static final XContentBuilderString SIZE = new XContentBuilderString("size"); - static final XContentBuilderString FIELDS = new XContentBuilderString("fields"); + static final String COMPLETION = "completion"; + static final String SIZE_IN_BYTES = "size_in_bytes"; + static final String SIZE = "size"; + static final String FIELDS = "fields"; } public void add(CompletionStats completion) { diff --git a/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestion.java b/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestion.java index 6435c37d36c..23949f1a096 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestion.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/phrase/PhraseSuggestion.java @@ -22,7 +22,6 @@ package org.elasticsearch.search.suggest.phrase; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.text.Text; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.search.suggest.Suggest; import org.elasticsearch.search.suggest.Suggest.Suggestion; @@ -53,7 +52,7 @@ public class PhraseSuggestion extends Suggest.Suggestion<PhraseSuggestion.Entry> public static class Entry extends Suggestion.Entry<Suggestion.Entry.Option> { static class Fields { - static final XContentBuilderString CUTOFF_SCORE = new XContentBuilderString("cutoff_score"); + static final String CUTOFF_SCORE = "cutoff_score"; } protected double cutoffScore = Double.MIN_VALUE; diff --git a/core/src/main/java/org/elasticsearch/search/suggest/term/TermSuggestion.java b/core/src/main/java/org/elasticsearch/search/suggest/term/TermSuggestion.java index dc29b6a1482..7673267ecf0 100644 --- a/core/src/main/java/org/elasticsearch/search/suggest/term/TermSuggestion.java +++ b/core/src/main/java/org/elasticsearch/search/suggest/term/TermSuggestion.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.text.Text; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.search.suggest.SortBy; import org.elasticsearch.search.suggest.Suggest.Suggestion; import org.elasticsearch.search.suggest.Suggest.Suggestion.Entry.Option; @@ -149,7 +148,7 @@ public class TermSuggestion extends Suggestion<TermSuggestion.Entry> { public static class Option extends org.elasticsearch.search.suggest.Suggest.Suggestion.Entry.Option { static class Fields { - static final XContentBuilderString FREQ = new XContentBuilderString("freq"); + static final String FREQ = "freq"; } private int freq; diff --git a/core/src/main/java/org/elasticsearch/snapshots/RestoreInfo.java b/core/src/main/java/org/elasticsearch/snapshots/RestoreInfo.java index 59d55dfaf4c..b7db7d25d8b 100644 --- a/core/src/main/java/org/elasticsearch/snapshots/RestoreInfo.java +++ b/core/src/main/java/org/elasticsearch/snapshots/RestoreInfo.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.RestStatus; import java.io.IOException; @@ -112,12 +111,12 @@ public class RestoreInfo implements ToXContent, Streamable { } static final class Fields { - static final XContentBuilderString SNAPSHOT = new XContentBuilderString("snapshot"); - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString FAILED = new XContentBuilderString("failed"); - static final XContentBuilderString SUCCESSFUL = new XContentBuilderString("successful"); + static final String SNAPSHOT = "snapshot"; + static final String INDICES = "indices"; + static final String SHARDS = "shards"; + static final String TOTAL = "total"; + static final String FAILED = "failed"; + static final String SUCCESSFUL = "successful"; } /** @@ -193,4 +192,4 @@ public class RestoreInfo implements ToXContent, Streamable { return in.readOptionalStreamable(RestoreInfo::new); } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/elasticsearch/snapshots/Snapshot.java b/core/src/main/java/org/elasticsearch/snapshots/Snapshot.java index 42eb255e8dd..13ec659b629 100644 --- a/core/src/main/java/org/elasticsearch/snapshots/Snapshot.java +++ b/core/src/main/java/org/elasticsearch/snapshots/Snapshot.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.ParseFieldMatcher; import org.elasticsearch.common.xcontent.FromXContentBuilder; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentParser; import java.io.IOException; @@ -239,17 +238,17 @@ public class Snapshot implements Comparable<Snapshot>, ToXContent, FromXContentB } static final class Fields { - static final XContentBuilderString SNAPSHOT = new XContentBuilderString("snapshot"); - static final XContentBuilderString NAME = new XContentBuilderString("name"); - static final XContentBuilderString VERSION_ID = new XContentBuilderString("version_id"); - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); - static final XContentBuilderString STATE = new XContentBuilderString("state"); - static final XContentBuilderString REASON = new XContentBuilderString("reason"); - static final XContentBuilderString START_TIME = new XContentBuilderString("start_time"); - static final XContentBuilderString END_TIME = new XContentBuilderString("end_time"); - static final XContentBuilderString TOTAL_SHARDS = new XContentBuilderString("total_shards"); - static final XContentBuilderString SUCCESSFUL_SHARDS = new XContentBuilderString("successful_shards"); - static final XContentBuilderString FAILURES = new XContentBuilderString("failures"); + static final String SNAPSHOT = "snapshot"; + static final String NAME = "name"; + static final String VERSION_ID = "version_id"; + static final String INDICES = "indices"; + static final String STATE = "state"; + static final String REASON = "reason"; + static final String START_TIME = "start_time"; + static final String END_TIME = "end_time"; + static final String TOTAL_SHARDS = "total_shards"; + static final String SUCCESSFUL_SHARDS = "successful_shards"; + static final String FAILURES = "failures"; } diff --git a/core/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java b/core/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java index 7b9506190f2..354094404ae 100644 --- a/core/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java +++ b/core/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.joda.FormatDateTimeFormatter; import org.elasticsearch.common.joda.Joda; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.rest.RestStatus; import java.io.IOException; @@ -199,22 +198,22 @@ public class SnapshotInfo implements ToXContent, Streamable { } static final class Fields { - static final XContentBuilderString INDICES = new XContentBuilderString("indices"); - static final XContentBuilderString STATE = new XContentBuilderString("state"); - static final XContentBuilderString REASON = new XContentBuilderString("reason"); - static final XContentBuilderString START_TIME = new XContentBuilderString("start_time"); - static final XContentBuilderString START_TIME_IN_MILLIS = new XContentBuilderString("start_time_in_millis"); - static final XContentBuilderString END_TIME = new XContentBuilderString("end_time"); - static final XContentBuilderString END_TIME_IN_MILLIS = new XContentBuilderString("end_time_in_millis"); - static final XContentBuilderString DURATION = new XContentBuilderString("duration"); - static final XContentBuilderString DURATION_IN_MILLIS = new XContentBuilderString("duration_in_millis"); - static final XContentBuilderString FAILURES = new XContentBuilderString("failures"); - static final XContentBuilderString SHARDS = new XContentBuilderString("shards"); - static final XContentBuilderString TOTAL = new XContentBuilderString("total"); - static final XContentBuilderString FAILED = new XContentBuilderString("failed"); - static final XContentBuilderString SUCCESSFUL = new XContentBuilderString("successful"); - static final XContentBuilderString VERSION_ID = new XContentBuilderString("version_id"); - static final XContentBuilderString VERSION = new XContentBuilderString("version"); + static final String INDICES = "indices"; + static final String STATE = "state"; + static final String REASON = "reason"; + static final String START_TIME = "start_time"; + static final String START_TIME_IN_MILLIS = "start_time_in_millis"; + static final String END_TIME = "end_time"; + static final String END_TIME_IN_MILLIS = "end_time_in_millis"; + static final String DURATION = "duration"; + static final String DURATION_IN_MILLIS = "duration_in_millis"; + static final String FAILURES = "failures"; + static final String SHARDS = "shards"; + static final String TOTAL = "total"; + static final String FAILED = "failed"; + static final String SUCCESSFUL = "successful"; + static final String VERSION_ID = "version_id"; + static final String VERSION = "version"; } @Override diff --git a/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java b/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java index f612a770b86..04860d1f84f 100644 --- a/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java +++ b/core/src/main/java/org/elasticsearch/threadpool/ThreadPool.java @@ -40,7 +40,6 @@ import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.util.concurrent.XRejectedExecutionHandler; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.node.Node; import java.io.Closeable; @@ -910,11 +909,11 @@ public class ThreadPool extends AbstractComponent implements Closeable { } static final class Fields { - static final XContentBuilderString TYPE = new XContentBuilderString("type"); - static final XContentBuilderString MIN = new XContentBuilderString("min"); - static final XContentBuilderString MAX = new XContentBuilderString("max"); - static final XContentBuilderString KEEP_ALIVE = new XContentBuilderString("keep_alive"); - static final XContentBuilderString QUEUE_SIZE = new XContentBuilderString("queue_size"); + static final String TYPE = "type"; + static final String MIN = "min"; + static final String MAX = "max"; + static final String KEEP_ALIVE = "keep_alive"; + static final String QUEUE_SIZE = "queue_size"; } } diff --git a/core/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java b/core/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java index 1fc77dacc29..729c6cb7364 100644 --- a/core/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java +++ b/core/src/main/java/org/elasticsearch/threadpool/ThreadPoolInfo.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.ArrayList; @@ -76,7 +75,7 @@ public class ThreadPoolInfo implements Streamable, Iterable<ThreadPool.Info>, To } static final class Fields { - static final XContentBuilderString THREAD_POOL = new XContentBuilderString("thread_pool"); + static final String THREAD_POOL = "thread_pool"; } @Override diff --git a/core/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java b/core/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java index f16d6a886d8..fdbbaef19d6 100644 --- a/core/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java +++ b/core/src/main/java/org/elasticsearch/threadpool/ThreadPoolStats.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.ArrayList; @@ -195,13 +194,13 @@ public class ThreadPoolStats implements Streamable, ToXContent, Iterable<ThreadP } static final class Fields { - static final XContentBuilderString THREAD_POOL = new XContentBuilderString("thread_pool"); - static final XContentBuilderString THREADS = new XContentBuilderString("threads"); - static final XContentBuilderString QUEUE = new XContentBuilderString("queue"); - static final XContentBuilderString ACTIVE = new XContentBuilderString("active"); - static final XContentBuilderString REJECTED = new XContentBuilderString("rejected"); - static final XContentBuilderString LARGEST = new XContentBuilderString("largest"); - static final XContentBuilderString COMPLETED = new XContentBuilderString("completed"); + static final String THREAD_POOL = "thread_pool"; + static final String THREADS = "threads"; + static final String QUEUE = "queue"; + static final String ACTIVE = "active"; + static final String REJECTED = "rejected"; + static final String LARGEST = "largest"; + static final String COMPLETED = "completed"; } @Override diff --git a/core/src/main/java/org/elasticsearch/transport/TransportInfo.java b/core/src/main/java/org/elasticsearch/transport/TransportInfo.java index 4b0da47adcb..236c0d50a98 100644 --- a/core/src/main/java/org/elasticsearch/transport/TransportInfo.java +++ b/core/src/main/java/org/elasticsearch/transport/TransportInfo.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.transport.BoundTransportAddress; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; import java.util.HashMap; @@ -49,10 +48,10 @@ public class TransportInfo implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString TRANSPORT = new XContentBuilderString("transport"); - static final XContentBuilderString BOUND_ADDRESS = new XContentBuilderString("bound_address"); - static final XContentBuilderString PUBLISH_ADDRESS = new XContentBuilderString("publish_address"); - static final XContentBuilderString PROFILES = new XContentBuilderString("profiles"); + static final String TRANSPORT = "transport"; + static final String BOUND_ADDRESS = "bound_address"; + static final String PUBLISH_ADDRESS = "publish_address"; + static final String PROFILES = "profiles"; } @Override diff --git a/core/src/main/java/org/elasticsearch/transport/TransportStats.java b/core/src/main/java/org/elasticsearch/transport/TransportStats.java index 36624b3a1a7..e34197fd738 100644 --- a/core/src/main/java/org/elasticsearch/transport/TransportStats.java +++ b/core/src/main/java/org/elasticsearch/transport/TransportStats.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -126,13 +125,13 @@ public class TransportStats implements Streamable, ToXContent { } static final class Fields { - static final XContentBuilderString TRANSPORT = new XContentBuilderString("transport"); - static final XContentBuilderString SERVER_OPEN = new XContentBuilderString("server_open"); - static final XContentBuilderString RX_COUNT = new XContentBuilderString("rx_count"); - static final XContentBuilderString RX_SIZE = new XContentBuilderString("rx_size"); - static final XContentBuilderString RX_SIZE_IN_BYTES = new XContentBuilderString("rx_size_in_bytes"); - static final XContentBuilderString TX_COUNT = new XContentBuilderString("tx_count"); - static final XContentBuilderString TX_SIZE = new XContentBuilderString("tx_size"); - static final XContentBuilderString TX_SIZE_IN_BYTES = new XContentBuilderString("tx_size_in_bytes"); + static final String TRANSPORT = "transport"; + static final String SERVER_OPEN = "server_open"; + static final String RX_COUNT = "rx_count"; + static final String RX_SIZE = "rx_size"; + static final String RX_SIZE_IN_BYTES = "rx_size_in_bytes"; + static final String TX_COUNT = "tx_count"; + static final String TX_SIZE = "tx_size"; + static final String TX_SIZE_IN_BYTES = "tx_size_in_bytes"; } -} \ No newline at end of file +} diff --git a/core/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java b/core/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java index 321ebc40e2f..42695959bbe 100644 --- a/core/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/common/xcontent/builder/XContentBuilderTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentGenerator; import org.elasticsearch.common.xcontent.XContentParser; @@ -278,9 +277,9 @@ public class XContentBuilderTests extends ESTestCase { assertThat(pathBuilder.string(), equalTo(stringBuilder.string())); } - public void testHandlingOfPath_XContentBuilderStringName() throws IOException { + public void testHandlingOfPath_StringName() throws IOException { Path path = PathUtils.get("path"); - XContentBuilderString name = new XContentBuilderString("file"); + String name = new String("file"); XContentBuilder pathBuilder = XContentFactory.contentBuilder(XContentType.JSON); pathBuilder.startObject().field(name, path).endObject(); diff --git a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java b/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java index b9ff364af1b..80fae396a25 100644 --- a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java +++ b/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/DeleteByQueryResponse.java @@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -169,10 +168,10 @@ public class DeleteByQueryResponse extends ActionResponse implements ToXContent } static final class Fields { - static final XContentBuilderString TOOK = new XContentBuilderString("took"); - static final XContentBuilderString TIMED_OUT = new XContentBuilderString("timed_out"); - static final XContentBuilderString INDICES = new XContentBuilderString("_indices"); - static final XContentBuilderString FAILURES = new XContentBuilderString("failures"); + static final String TOOK = "took"; + static final String TIMED_OUT = "timed_out"; + static final String INDICES = "_indices"; + static final String FAILURES = "failures"; } @Override diff --git a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java b/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java index 352749bda0b..78fca1ef5f1 100644 --- a/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java +++ b/plugins/delete-by-query/src/main/java/org/elasticsearch/action/deletebyquery/IndexDeleteByQueryResponse.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentBuilderString; import java.io.IOException; @@ -137,10 +136,10 @@ public class IndexDeleteByQueryResponse extends ActionResponse implements ToXCon } static final class Fields { - static final XContentBuilderString FOUND = new XContentBuilderString("found"); - static final XContentBuilderString DELETED = new XContentBuilderString("deleted"); - static final XContentBuilderString MISSING = new XContentBuilderString("missing"); - static final XContentBuilderString FAILED = new XContentBuilderString("failed"); + static final String FOUND = "found"; + static final String DELETED = "deleted"; + static final String MISSING = "missing"; + static final String FAILED = "failed"; } @Override @@ -153,4 +152,4 @@ public class IndexDeleteByQueryResponse extends ActionResponse implements ToXCon builder.endObject(); return builder; } -} \ No newline at end of file +}