diff --git a/.idea/runConfigurations/Elastic_Search_Tests.xml b/.idea/runConfigurations/Elastic_Search_Tests.xml
index af5ef13bebc..40d12d65d0f 100644
--- a/.idea/runConfigurations/Elastic_Search_Tests.xml
+++ b/.idea/runConfigurations/Elastic_Search_Tests.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/AbstractListenableActionFuture.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/AbstractListenableActionFuture.java
index 1866a2bf83b..d6e9b6203fa 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/AbstractListenableActionFuture.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/support/AbstractListenableActionFuture.java
@@ -23,11 +23,10 @@ import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.threadpool.ThreadPool;
+import org.elasticsearch.util.collect.Lists;
import java.util.List;
-import static org.elasticsearch.util.collect.Lists.*;
-
/**
* @author kimchy (shay.banon)
*/
@@ -67,7 +66,7 @@ public abstract class AbstractListenableActionFuture extends AdapterAction
((List) this.listeners).add(listener);
} else {
Object orig = listeners;
- listeners = newArrayListWithExpectedSize(2);
+ listeners = Lists.newArrayListWithCapacity(2);
((List) listeners).add(orig);
((List) listeners).add(listener);
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java
index dc1d1377681..9f220f64537 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java
@@ -43,7 +43,6 @@ import java.io.IOException;
import java.util.*;
import static org.elasticsearch.util.MapBuilder.*;
-import static org.elasticsearch.util.collect.Lists.*;
import static org.elasticsearch.util.collect.Sets.*;
/**
@@ -159,7 +158,7 @@ public class MetaData implements Iterable {
}
}
- ArrayList actualIndices = newArrayListWithExpectedSize(indices.length);
+ ArrayList actualIndices = Lists.newArrayListWithCapacity(indices.length);
for (String index : indices) {
String[] actualLst = aliasAndIndexToIndexMap.get(index);
if (actualLst == null) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexShardRoutingTable.java b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexShardRoutingTable.java
index e871a392555..2b801c3a911 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexShardRoutingTable.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/cluster/routing/IndexShardRoutingTable.java
@@ -21,6 +21,7 @@ package org.elasticsearch.cluster.routing;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.util.collect.ImmutableList;
+import org.elasticsearch.util.collect.Lists;
import org.elasticsearch.util.collect.UnmodifiableIterator;
import org.elasticsearch.util.concurrent.jsr166y.ThreadLocalRandom;
import org.elasticsearch.util.io.stream.StreamInput;
@@ -97,7 +98,7 @@ public class IndexShardRoutingTable implements Iterable {
}
public List backupsShards() {
- List backupShards = newArrayListWithExpectedSize(2);
+ List backupShards = Lists.newArrayListWithCapacity(2);
for (ShardRouting shardRouting : this) {
if (!shardRouting.primary()) {
backupShards.add(shardRouting);
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/elect/ElectMasterService.java b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/elect/ElectMasterService.java
index 5005e40f305..1347a033cc8 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/elect/ElectMasterService.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/discovery/zen/elect/ElectMasterService.java
@@ -29,8 +29,6 @@ import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
-import static org.elasticsearch.util.collect.Lists.*;
-
/**
* @author kimchy (shay.banon)
*/
@@ -50,7 +48,7 @@ public class ElectMasterService extends AbstractComponent {
if (sortedNodes == null) {
return new DiscoveryNode[0];
}
- List nextPossibleMasters = newArrayListWithExpectedSize(numberOfPossibleMasters);
+ List nextPossibleMasters = Lists.newArrayListWithCapacity(numberOfPossibleMasters);
int counter = 0;
for (DiscoveryNode nextPossibleMaster : sortedNodes) {
if (++counter >= numberOfPossibleMasters) {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexShardGateway.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexShardGateway.java
index 57327c356ec..9f327cd43c3 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexShardGateway.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/fs/FsIndexShardGateway.java
@@ -38,6 +38,7 @@ import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.util.SizeUnit;
import org.elasticsearch.util.SizeValue;
import org.elasticsearch.util.TimeValue;
+import org.elasticsearch.util.collect.Lists;
import org.elasticsearch.util.inject.Inject;
import org.elasticsearch.util.io.stream.DataInputStreamInput;
import org.elasticsearch.util.io.stream.DataOutputStreamOutput;
@@ -54,7 +55,6 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import static org.elasticsearch.index.translog.TranslogStreams.*;
-import static org.elasticsearch.util.collect.Lists.*;
import static org.elasticsearch.util.io.FileSystemUtils.*;
import static org.elasticsearch.util.lucene.Directories.*;
@@ -377,7 +377,7 @@ public class FsIndexShardGateway extends AbstractIndexShardComponent implements
File recoveryTranslogFile = new File(locationTranslog, "translog-" + recoveryTranslogId);
raf = new RandomAccessFile(recoveryTranslogFile, "r");
int numberOfOperations = raf.readInt();
- ArrayList operations = newArrayListWithExpectedSize(numberOfOperations);
+ ArrayList operations = Lists.newArrayListWithCapacity(numberOfOperations);
for (int i = 0; i < numberOfOperations; i++) {
operations.add(readTranslogOperation(new DataInputStreamInput(raf)));
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/controller/SearchPhaseController.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/controller/SearchPhaseController.java
index e82c966fadd..b51a3c9b768 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/controller/SearchPhaseController.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/controller/SearchPhaseController.java
@@ -29,8 +29,8 @@ import org.elasticsearch.search.SearchShardTarget;
import org.elasticsearch.search.dfs.AggregatedDfs;
import org.elasticsearch.search.dfs.DfsSearchResult;
import org.elasticsearch.search.facets.Facet;
-import org.elasticsearch.search.facets.Facets;
-import org.elasticsearch.search.facets.InternalFacet;
+import org.elasticsearch.search.facets.internal.InternalFacet;
+import org.elasticsearch.search.facets.internal.InternalFacets;
import org.elasticsearch.search.fetch.FetchSearchResult;
import org.elasticsearch.search.fetch.FetchSearchResultProvider;
import org.elasticsearch.search.internal.InternalSearchHit;
@@ -148,7 +148,7 @@ public class SearchPhaseController {
public InternalSearchResponse merge(ShardDoc[] sortedDocs, Map queryResults, Map fetchResults) {
// merge facets
- Facets facets = null;
+ InternalFacets facets = null;
if (!queryResults.isEmpty()) {
// we rely on the fact that the order of facets is the same on all query results
QuerySearchResult queryResult = queryResults.values().iterator().next().queryResult();
@@ -163,7 +163,7 @@ public class SearchPhaseController {
for (Facet facet : queryResult.facets().facets()) {
mergedFacets.add(((InternalFacet) facet).aggregate(allFacets));
}
- facets = new Facets(mergedFacets);
+ facets = new InternalFacets(mergedFacets);
}
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/Facet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/Facet.java
index 858daf353c6..a778b63ec4c 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/Facet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/Facet.java
@@ -20,6 +20,9 @@
package org.elasticsearch.search.facets;
import org.elasticsearch.ElasticSearchIllegalArgumentException;
+import org.elasticsearch.search.facets.query.QueryFacet;
+import org.elasticsearch.search.facets.statistical.StatisticalFacet;
+import org.elasticsearch.search.facets.terms.TermsFacet;
/**
* A search facet.
@@ -28,21 +31,50 @@ import org.elasticsearch.ElasticSearchIllegalArgumentException;
*/
public interface Facet {
+ /**
+ * The type of the facet.
+ */
enum Type {
- TERMS(0),
- QUERY(1),
- STATISTICAL(2);
+ /**
+ * Terms facet type, matching {@link TermsFacet}.
+ */
+ TERMS(0, TermsFacet.class),
+ /**
+ * Query facet type, matching {@link QueryFacet}.
+ */
+ QUERY(1, QueryFacet.class),
+ /**
+ * Statistical facet type, matching {@link StatisticalFacet}.
+ */
+ STATISTICAL(2, StatisticalFacet.class);
- int id;
+ private int id;
- Type(int id) {
+ private Class extends Facet> type;
+
+ Type(int id, Class extends Facet> type) {
this.id = id;
+ this.type = type;
}
public int id() {
return id;
}
+ /**
+ * The facet class type.
+ */
+ public Class extends Facet> type() {
+ return this.type;
+ }
+
+ /**
+ * The facet class type.
+ */
+ public Class extends Facet> getType() {
+ return type();
+ }
+
public static Type fromId(int id) {
if (id == 0) {
return TERMS;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/Facets.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/Facets.java
index 4cdd9790d0d..e631767fc48 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/Facets.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/Facets.java
@@ -19,138 +19,38 @@
package org.elasticsearch.search.facets;
-import org.elasticsearch.search.facets.query.InternalQueryFacet;
-import org.elasticsearch.search.facets.statistical.InternalStatisticalFacet;
-import org.elasticsearch.search.facets.terms.InternalTermsFacet;
-import org.elasticsearch.util.collect.ImmutableList;
-import org.elasticsearch.util.io.stream.StreamInput;
-import org.elasticsearch.util.io.stream.StreamOutput;
-import org.elasticsearch.util.io.stream.Streamable;
-import org.elasticsearch.util.xcontent.ToXContent;
-import org.elasticsearch.util.xcontent.builder.XContentBuilder;
-
-import java.io.IOException;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import static org.elasticsearch.util.collect.Lists.*;
-import static org.elasticsearch.util.collect.Maps.*;
-
/**
* Facets of search action.
*
* @author kimchy (shay.banon)
*/
-public class Facets implements Streamable, ToXContent, Iterable {
-
- private final List EMPTY = ImmutableList.of();
-
- private List facets = EMPTY;
-
- private Map facetsAsMap;
-
- private Facets() {
-
- }
-
- /**
- * Constructs a new facets.
- */
- public Facets(List facets) {
- this.facets = facets;
- }
-
- /**
- * Iterates over the {@link Facet}s.
- */
- @Override public Iterator iterator() {
- return facets.iterator();
- }
+public interface Facets extends Iterable {
/**
* The list of {@link Facet}s.
*/
- public List facets() {
- return facets;
- }
+ List facets();
/**
- * Returns the {@link Facet}s keyed by map.
+ * Returns the {@link Facet}s keyed by facet name.
*/
- public Map getFacets() {
- return facetsAsMap();
- }
+ Map getFacets();
/**
- * Returns the {@link Facet}s keyed by map.
+ * Returns the {@link Facet}s keyed by facet name.
*/
- public Map facetsAsMap() {
- if (facetsAsMap != null) {
- return facetsAsMap;
- }
- Map facetsAsMap = newHashMap();
- for (Facet facet : facets) {
- facetsAsMap.put(facet.name(), facet);
- }
- this.facetsAsMap = facetsAsMap;
- return facetsAsMap;
- }
+ Map facetsAsMap();
/**
* Returns the facet by name already casted to the specified type.
*/
- public T facet(Class facetType, String name) {
- return facetType.cast(facet(name));
- }
+ T facet(Class facetType, String name);
/**
* A facet of the specified name.
*/
- public Facet facet(String name) {
- return facetsAsMap().get(name);
- }
-
- @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
- builder.startObject("facets");
- for (Facet facet : facets) {
- ((InternalFacet) facet).toXContent(builder, params);
- }
- builder.endObject();
- }
-
- public static Facets readFacets(StreamInput in) throws IOException {
- Facets result = new Facets();
- result.readFrom(in);
- return result;
- }
-
- @Override public void readFrom(StreamInput in) throws IOException {
- int size = in.readVInt();
- if (size == 0) {
- facets = EMPTY;
- } else {
- facets = newArrayListWithCapacity(size);
- for (int i = 0; i < size; i++) {
- int id = in.readVInt();
- if (id == Facet.Type.TERMS.id()) {
- facets.add(InternalTermsFacet.readTermsFacet(in));
- } else if (id == Facet.Type.QUERY.id()) {
- facets.add(InternalQueryFacet.readCountFacet(in));
- } else if (id == Facet.Type.STATISTICAL.id()) {
- facets.add(InternalStatisticalFacet.readStatisticalFacet(in));
- } else {
- throw new IOException("Can't handle facet type with id [" + id + "]");
- }
- }
- }
- }
-
- @Override public void writeTo(StreamOutput out) throws IOException {
- out.writeVInt(facets.size());
- for (Facet facet : facets) {
- out.writeVInt(facet.type().id());
- ((InternalFacet) facet).writeTo(out);
- }
- }
+ Facet facet(String name);
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/FacetsPhase.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/FacetsPhase.java
index 4baf4a252ee..20020407933 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/FacetsPhase.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/FacetsPhase.java
@@ -25,6 +25,7 @@ import org.elasticsearch.index.mapper.DocumentMapper;
import org.elasticsearch.search.SearchParseElement;
import org.elasticsearch.search.SearchPhase;
import org.elasticsearch.search.facets.collector.FacetCollector;
+import org.elasticsearch.search.facets.internal.InternalFacets;
import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.search.query.QueryPhaseExecutionException;
import org.elasticsearch.util.collect.ImmutableMap;
@@ -98,6 +99,6 @@ public class FacetsPhase implements SearchPhase {
facets.add(facetCollector.facet());
}
}
- context.queryResult().facets(new Facets(facets));
+ context.queryResult().facets(new InternalFacets(facets));
}
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/InternalFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacet.java
similarity index 93%
rename from modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/InternalFacet.java
rename to modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacet.java
index b896ded4fa0..4a37db8e5ef 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/InternalFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacet.java
@@ -17,8 +17,9 @@
* under the License.
*/
-package org.elasticsearch.search.facets;
+package org.elasticsearch.search.facets.internal;
+import org.elasticsearch.search.facets.Facet;
import org.elasticsearch.util.io.stream.Streamable;
import org.elasticsearch.util.xcontent.ToXContent;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java
new file mode 100644
index 00000000000..108141a7ec1
--- /dev/null
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/internal/InternalFacets.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to Elastic Search and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. Elastic Search 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.search.facets.internal;
+
+import org.elasticsearch.search.facets.Facet;
+import org.elasticsearch.search.facets.Facets;
+import org.elasticsearch.search.facets.query.InternalQueryFacet;
+import org.elasticsearch.search.facets.statistical.InternalStatisticalFacet;
+import org.elasticsearch.search.facets.terms.InternalTermsFacet;
+import org.elasticsearch.util.collect.ImmutableList;
+import org.elasticsearch.util.collect.ImmutableMap;
+import org.elasticsearch.util.collect.Lists;
+import org.elasticsearch.util.io.stream.StreamInput;
+import org.elasticsearch.util.io.stream.StreamOutput;
+import org.elasticsearch.util.io.stream.Streamable;
+import org.elasticsearch.util.xcontent.ToXContent;
+import org.elasticsearch.util.xcontent.builder.XContentBuilder;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import static org.elasticsearch.util.collect.Maps.*;
+
+/**
+ * @author kimchy (shay.banon)
+ */
+public class InternalFacets implements Facets, Streamable, ToXContent, Iterable {
+
+ private List facets = ImmutableList.of();
+
+ private Map facetsAsMap;
+
+ private InternalFacets() {
+
+ }
+
+ /**
+ * Constructs a new facets.
+ */
+ public InternalFacets(List facets) {
+ this.facets = facets;
+ }
+
+ /**
+ * Iterates over the {@link Facet}s.
+ */
+ @Override public Iterator iterator() {
+ return facets.iterator();
+ }
+
+ /**
+ * The list of {@link Facet}s.
+ */
+ public List facets() {
+ return facets;
+ }
+
+ /**
+ * Returns the {@link Facet}s keyed by map.
+ */
+ public Map getFacets() {
+ return facetsAsMap();
+ }
+
+ /**
+ * Returns the {@link Facet}s keyed by map.
+ */
+ public Map facetsAsMap() {
+ if (facetsAsMap != null) {
+ return facetsAsMap;
+ }
+ Map facetsAsMap = newHashMap();
+ for (Facet facet : facets) {
+ facetsAsMap.put(facet.name(), facet);
+ }
+ this.facetsAsMap = facetsAsMap;
+ return facetsAsMap;
+ }
+
+ /**
+ * Returns the facet by name already casted to the specified type.
+ */
+ public T facet(Class facetType, String name) {
+ return facetType.cast(facet(name));
+ }
+
+ /**
+ * A facet of the specified name.
+ */
+ public Facet facet(String name) {
+ return facetsAsMap().get(name);
+ }
+
+ @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
+ builder.startObject("facets");
+ for (Facet facet : facets) {
+ ((InternalFacet) facet).toXContent(builder, params);
+ }
+ builder.endObject();
+ }
+
+ public static InternalFacets readFacets(StreamInput in) throws IOException {
+ InternalFacets result = new InternalFacets();
+ result.readFrom(in);
+ return result;
+ }
+
+ @Override public void readFrom(StreamInput in) throws IOException {
+ int size = in.readVInt();
+ if (size == 0) {
+ facets = ImmutableList.of();
+ facetsAsMap = ImmutableMap.of();
+ } else {
+ facets = Lists.newArrayListWithCapacity(size);
+ for (int i = 0; i < size; i++) {
+ int id = in.readVInt();
+ if (id == Facet.Type.TERMS.id()) {
+ facets.add(InternalTermsFacet.readTermsFacet(in));
+ } else if (id == Facet.Type.QUERY.id()) {
+ facets.add(InternalQueryFacet.readCountFacet(in));
+ } else if (id == Facet.Type.STATISTICAL.id()) {
+ facets.add(InternalStatisticalFacet.readStatisticalFacet(in));
+ } else {
+ throw new IOException("Can't handle facet type with id [" + id + "]");
+ }
+ }
+ }
+ }
+
+ @Override public void writeTo(StreamOutput out) throws IOException {
+ out.writeVInt(facets.size());
+ for (Facet facet : facets) {
+ out.writeVInt(facet.type().id());
+ ((InternalFacet) facet).writeTo(out);
+ }
+ }
+}
+
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java
index c91d7c179cb..6baa2b28209 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/query/InternalQueryFacet.java
@@ -20,7 +20,7 @@
package org.elasticsearch.search.facets.query;
import org.elasticsearch.search.facets.Facet;
-import org.elasticsearch.search.facets.InternalFacet;
+import org.elasticsearch.search.facets.internal.InternalFacet;
import org.elasticsearch.util.io.stream.StreamInput;
import org.elasticsearch.util.io.stream.StreamOutput;
import org.elasticsearch.util.xcontent.builder.XContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java
index 52d08120320..3730d3ac62f 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/statistical/InternalStatisticalFacet.java
@@ -20,7 +20,7 @@
package org.elasticsearch.search.facets.statistical;
import org.elasticsearch.search.facets.Facet;
-import org.elasticsearch.search.facets.InternalFacet;
+import org.elasticsearch.search.facets.internal.InternalFacet;
import org.elasticsearch.util.io.stream.StreamInput;
import org.elasticsearch.util.io.stream.StreamOutput;
import org.elasticsearch.util.xcontent.builder.XContentBuilder;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java
index 1001d93f8e6..76ed6595248 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/facets/terms/InternalTermsFacet.java
@@ -20,7 +20,7 @@
package org.elasticsearch.search.facets.terms;
import org.elasticsearch.search.facets.Facet;
-import org.elasticsearch.search.facets.InternalFacet;
+import org.elasticsearch.search.facets.internal.InternalFacet;
import org.elasticsearch.util.BoundedTreeSet;
import org.elasticsearch.util.ThreadLocals;
import org.elasticsearch.util.collect.ImmutableList;
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java
index a5e4bfbbda7..cfe49e66204 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/internal/InternalSearchResponse.java
@@ -21,6 +21,7 @@ package org.elasticsearch.search.internal;
import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.facets.Facets;
+import org.elasticsearch.search.facets.internal.InternalFacets;
import org.elasticsearch.util.io.stream.StreamInput;
import org.elasticsearch.util.io.stream.StreamOutput;
import org.elasticsearch.util.io.stream.Streamable;
@@ -29,7 +30,6 @@ import org.elasticsearch.util.xcontent.builder.XContentBuilder;
import java.io.IOException;
-import static org.elasticsearch.search.facets.Facets.*;
import static org.elasticsearch.search.internal.InternalSearchHits.*;
/**
@@ -39,12 +39,12 @@ public class InternalSearchResponse implements Streamable, ToXContent {
private InternalSearchHits hits;
- private Facets facets;
+ private InternalFacets facets;
private InternalSearchResponse() {
}
- public InternalSearchResponse(InternalSearchHits hits, Facets facets) {
+ public InternalSearchResponse(InternalSearchHits hits, InternalFacets facets) {
this.hits = hits;
this.facets = facets;
}
@@ -73,7 +73,7 @@ public class InternalSearchResponse implements Streamable, ToXContent {
@Override public void readFrom(StreamInput in) throws IOException {
hits = readSearchHits(in);
if (in.readBoolean()) {
- facets = readFacets(in);
+ facets = InternalFacets.readFacets(in);
}
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchResult.java b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchResult.java
index 56d837553bd..3052e77dd88 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchResult.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/search/query/QuerySearchResult.java
@@ -22,6 +22,7 @@ package org.elasticsearch.search.query;
import org.apache.lucene.search.TopDocs;
import org.elasticsearch.search.SearchShardTarget;
import org.elasticsearch.search.facets.Facets;
+import org.elasticsearch.search.facets.internal.InternalFacets;
import org.elasticsearch.util.io.stream.StreamInput;
import org.elasticsearch.util.io.stream.StreamOutput;
import org.elasticsearch.util.io.stream.Streamable;
@@ -29,7 +30,6 @@ import org.elasticsearch.util.io.stream.Streamable;
import java.io.IOException;
import static org.elasticsearch.search.SearchShardTarget.*;
-import static org.elasticsearch.search.facets.Facets.*;
import static org.elasticsearch.util.lucene.Lucene.*;
/**
@@ -47,7 +47,7 @@ public class QuerySearchResult implements Streamable, QuerySearchResultProvider
private TopDocs topDocs;
- private Facets facets;
+ private InternalFacets facets;
private boolean searchTimedOut;
@@ -96,7 +96,7 @@ public class QuerySearchResult implements Streamable, QuerySearchResultProvider
return facets;
}
- public void facets(Facets facets) {
+ public void facets(InternalFacets facets) {
this.facets = facets;
}
@@ -131,7 +131,7 @@ public class QuerySearchResult implements Streamable, QuerySearchResultProvider
size = in.readVInt();
topDocs = readTopDocs(in);
if (in.readBoolean()) {
- facets = readFacets(in);
+ facets = InternalFacets.readFacets(in);
}
searchTimedOut = in.readBoolean();
}