Uppercase ells ('L') in long literals
This commit removes and forbids the use of lowercase ells ('l') in long literals because they are often hard to distinguish from the digit representing one ('1'). Closes #16329
This commit is contained in:
parent
4e8623f8f4
commit
105411060c
|
@ -28,6 +28,9 @@
|
|||
<module name="NoLineWrap" />
|
||||
<!-- Each java file has only one outer class -->
|
||||
<module name="OneTopLevelClass" />
|
||||
<!-- The suffix L is preferred, because the letter l (ell) is often
|
||||
hard to distinguish from the digit 1 (one). -->
|
||||
<module name="UpperEll"/>
|
||||
|
||||
<!-- We don't use Java's builtin serialization and we suppress all warning
|
||||
about it. The flip side of that coin is that we shouldn't _try_ to use
|
||||
|
|
|
@ -302,7 +302,7 @@ public class IndexMetaData implements Diffable<IndexMetaData>, FromXContentBuild
|
|||
}
|
||||
|
||||
public long getCreationDate() {
|
||||
return settings.getAsLong(SETTING_CREATION_DATE, -1l);
|
||||
return settings.getAsLong(SETTING_CREATION_DATE, -1L);
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
|
|
|
@ -106,7 +106,7 @@ public class UnassignedInfo implements ToXContent, Writeable<UnassignedInfo> {
|
|||
private final Reason reason;
|
||||
private final long unassignedTimeMillis; // used for display and log messages, in milliseconds
|
||||
private final long unassignedTimeNanos; // in nanoseconds, used to calculate delay for delayed shard allocation
|
||||
private volatile long lastComputedLeftDelayNanos = 0l; // how long to delay shard allocation, not serialized (always positive, 0 means no delay)
|
||||
private volatile long lastComputedLeftDelayNanos = 0L; // how long to delay shard allocation, not serialized (always positive, 0 means no delay)
|
||||
private final String message;
|
||||
private final Throwable failure;
|
||||
|
||||
|
@ -217,7 +217,7 @@ public class UnassignedInfo implements ToXContent, Writeable<UnassignedInfo> {
|
|||
return 0;
|
||||
}
|
||||
TimeValue delayTimeout = INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.get(indexSettings, settings);
|
||||
return Math.max(0l, delayTimeout.nanos());
|
||||
return Math.max(0L, delayTimeout.nanos());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,8 +236,8 @@ public class UnassignedInfo implements ToXContent, Writeable<UnassignedInfo> {
|
|||
public long updateDelay(long nanoTimeNow, Settings settings, Settings indexSettings) {
|
||||
long delayTimeoutNanos = getAllocationDelayTimeoutSettingNanos(settings, indexSettings);
|
||||
final long newComputedLeftDelayNanos;
|
||||
if (delayTimeoutNanos == 0l) {
|
||||
newComputedLeftDelayNanos = 0l;
|
||||
if (delayTimeoutNanos == 0L) {
|
||||
newComputedLeftDelayNanos = 0L;
|
||||
} else {
|
||||
assert nanoTimeNow >= unassignedTimeNanos;
|
||||
newComputedLeftDelayNanos = Math.max(0L, delayTimeoutNanos - (nanoTimeNow - unassignedTimeNanos));
|
||||
|
@ -277,7 +277,7 @@ public class UnassignedInfo implements ToXContent, Writeable<UnassignedInfo> {
|
|||
}
|
||||
}
|
||||
}
|
||||
return minDelaySetting == Long.MAX_VALUE ? 0l : minDelaySetting;
|
||||
return minDelaySetting == Long.MAX_VALUE ? 0L : minDelaySetting;
|
||||
}
|
||||
|
||||
|
||||
|
@ -294,7 +294,7 @@ public class UnassignedInfo implements ToXContent, Writeable<UnassignedInfo> {
|
|||
}
|
||||
}
|
||||
}
|
||||
return nextDelay == Long.MAX_VALUE ? 0l : nextDelay;
|
||||
return nextDelay == Long.MAX_VALUE ? 0L : nextDelay;
|
||||
}
|
||||
|
||||
public String shortSummary() {
|
||||
|
|
|
@ -179,7 +179,7 @@ public class GeoUtils {
|
|||
final double width = Math.sqrt((meters*meters)/(ratio*ratio)); // convert to cell width
|
||||
final long part = Math.round(Math.ceil(EARTH_EQUATOR / width));
|
||||
final int level = Long.SIZE - Long.numberOfLeadingZeros(part)-1; // (log_2)
|
||||
return (part<=(1l<<level)) ?level :(level+1); // adjust level
|
||||
return (part<=(1L<<level)) ?level :(level+1); // adjust level
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import java.util.concurrent.TimeUnit;
|
|||
public class DiscoveryService extends AbstractLifecycleComponent<DiscoveryService> {
|
||||
|
||||
public static final Setting<TimeValue> INITIAL_STATE_TIMEOUT_SETTING = Setting.positiveTimeSetting("discovery.initial_state_timeout", TimeValue.timeValueSeconds(30), false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Long> DISCOVERY_SEED_SETTING = Setting.longSetting("discovery.id.seed", 0l, Long.MIN_VALUE, false, Setting.Scope.CLUSTER);
|
||||
public static final Setting<Long> DISCOVERY_SEED_SETTING = Setting.longSetting("discovery.id.seed", 0L, Long.MIN_VALUE, false, Setting.Scope.CLUSTER);
|
||||
|
||||
private static class InitialStateListener implements InitialStateDiscoveryListener {
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public abstract class PriorityComparator implements Comparator<ShardRouting> {
|
|||
}
|
||||
|
||||
private long timeCreated(Settings settings) {
|
||||
return settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1l);
|
||||
return settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L);
|
||||
}
|
||||
|
||||
protected abstract Settings getIndexSettings(String index);
|
||||
|
|
|
@ -456,7 +456,7 @@ public final class IndexService extends AbstractIndexComponent implements IndexC
|
|||
if (shardId != null) {
|
||||
final IndexShard shard = indexService.getShardOrNull(shardId.id());
|
||||
if (shard != null) {
|
||||
long ramBytesUsed = accountable != null ? accountable.ramBytesUsed() : 0l;
|
||||
long ramBytesUsed = accountable != null ? accountable.ramBytesUsed() : 0L;
|
||||
shard.shardBitsetFilterCache().onCached(ramBytesUsed);
|
||||
}
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ public final class IndexService extends AbstractIndexComponent implements IndexC
|
|||
if (shardId != null) {
|
||||
final IndexShard shard = indexService.getShardOrNull(shardId.id());
|
||||
if (shard != null) {
|
||||
long ramBytesUsed = accountable != null ? accountable.ramBytesUsed() : 0l;
|
||||
long ramBytesUsed = accountable != null ? accountable.ramBytesUsed() : 0L;
|
||||
shard.shardBitsetFilterCache().onRemoval(ramBytesUsed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public interface ScriptDocValues<T> extends List<T> {
|
|||
public long getValue() {
|
||||
int numValues = values.count();
|
||||
if (numValues == 0) {
|
||||
return 0l;
|
||||
return 0L;
|
||||
}
|
||||
return values.valueAt(0);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
|||
}
|
||||
|
||||
public static final String DEFAULT_MAPPING = "_default_";
|
||||
public static final Setting<Long> INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING = Setting.longSetting("index.mapping.nested_fields.limit", 50l, 0, true, Setting.Scope.INDEX);
|
||||
public static final Setting<Long> INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING = Setting.longSetting("index.mapping.nested_fields.limit", 50L, 0, true, Setting.Scope.INDEX);
|
||||
public static final boolean INDEX_MAPPER_DYNAMIC_DEFAULT = true;
|
||||
public static final Setting<Boolean> INDEX_MAPPER_DYNAMIC_SETTING = Setting.boolSetting("index.mapper.dynamic", INDEX_MAPPER_DYNAMIC_DEFAULT, false, Setting.Scope.INDEX);
|
||||
private static ObjectHashSet<String> META_FIELDS = ObjectHashSet.from(
|
||||
|
|
|
@ -66,7 +66,7 @@ import static org.elasticsearch.index.mapper.core.TypeParsers.parseNumberField;
|
|||
public class IpFieldMapper extends NumberFieldMapper {
|
||||
|
||||
public static final String CONTENT_TYPE = "ip";
|
||||
public static final long MAX_IP = 4294967296l;
|
||||
public static final long MAX_IP = 4294967296L;
|
||||
|
||||
public static String longToIp(long longIp) {
|
||||
int octet3 = (int) ((longIp >> 24) % 256);
|
||||
|
|
|
@ -930,7 +930,7 @@ public class Store extends AbstractIndexShardComponent implements Closeable, Ref
|
|||
return new Tuple<>(indexInput.readStringStringMap(), lastFound);
|
||||
}
|
||||
}
|
||||
return new Tuple<>(new HashMap<>(), -1l);
|
||||
return new Tuple<>(new HashMap<>(), -1L);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1132,7 +1132,7 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> imp
|
|||
// Use the same value for both checks since lastAccessTime can
|
||||
// be modified by another thread between checks!
|
||||
final long lastAccessTime = context.lastAccessTime();
|
||||
if (lastAccessTime == -1l) { // its being processed or timeout is disabled
|
||||
if (lastAccessTime == -1L) { // its being processed or timeout is disabled
|
||||
continue;
|
||||
}
|
||||
if ((time - lastAccessTime > context.keepAlive())) {
|
||||
|
|
|
@ -110,7 +110,7 @@ public class AvgAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalAvg(name, 0.0, 0l, formatter, pipelineAggregators(), metaData());
|
||||
return new InternalAvg(name, 0.0, 0L, formatter, pipelineAggregators(), metaData());
|
||||
}
|
||||
|
||||
public static class Factory extends ValuesSourceAggregatorFactory.LeafOnly<ValuesSource.Numeric> {
|
||||
|
|
|
@ -114,7 +114,7 @@ public final class GeoCentroidAggregator extends MetricsAggregator {
|
|||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalGeoCentroid(name, null, 0l, pipelineAggregators(), metaData());
|
||||
return new InternalGeoCentroid(name, null, 0L, pipelineAggregators(), metaData());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -100,7 +100,7 @@ public class ValueCountAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalValueCount(name, 0l, formatter, pipelineAggregators(), metaData());
|
||||
return new InternalValueCount(name, 0L, formatter, pipelineAggregators(), metaData());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -119,7 +119,7 @@ public class HotThreadsIT extends ESIntegTestCase {
|
|||
.setQuery(matchAllQuery())
|
||||
.setPostFilter(boolQuery().must(matchAllQuery()).mustNot(boolQuery().must(termQuery("field1", "value1")).must(termQuery("field1", "value2"))))
|
||||
.get(),
|
||||
3l);
|
||||
3L);
|
||||
}
|
||||
latch.await();
|
||||
assertThat(hasErrors.get(), is(false));
|
||||
|
|
|
@ -93,7 +93,7 @@ public class ClusterStatsIT extends ESIntegTestCase {
|
|||
ensureYellow();
|
||||
response = client().admin().cluster().prepareClusterStats().get();
|
||||
assertThat(response.getStatus(), Matchers.equalTo(ClusterHealthStatus.YELLOW));
|
||||
assertThat(response.indicesStats.getDocs().getCount(), Matchers.equalTo(0l));
|
||||
assertThat(response.indicesStats.getDocs().getCount(), Matchers.equalTo(0L));
|
||||
assertThat(response.indicesStats.getIndexCount(), Matchers.equalTo(1));
|
||||
assertShardStats(response.getIndicesStats().getShards(), 1, 2, 2, 0.0);
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class ClusterStatsIT extends ESIntegTestCase {
|
|||
refresh(); // make the doc visible
|
||||
response = client().admin().cluster().prepareClusterStats().get();
|
||||
assertThat(response.getStatus(), Matchers.equalTo(ClusterHealthStatus.GREEN));
|
||||
assertThat(response.indicesStats.getDocs().getCount(), Matchers.equalTo(1l));
|
||||
assertThat(response.indicesStats.getDocs().getCount(), Matchers.equalTo(1L));
|
||||
assertShardStats(response.getIndicesStats().getShards(), 1, 4, 2, 1.0);
|
||||
|
||||
prepareCreate("test2").setSettings("number_of_shards", 3, "number_of_replicas", 0).get();
|
||||
|
@ -141,10 +141,10 @@ public class ClusterStatsIT extends ESIntegTestCase {
|
|||
ensureYellow("test1");
|
||||
ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get();
|
||||
String msg = response.toString();
|
||||
assertThat(msg, response.getTimestamp(), Matchers.greaterThan(946681200000l)); // 1 Jan 2000
|
||||
assertThat(msg, response.indicesStats.getStore().getSizeInBytes(), Matchers.greaterThan(0l));
|
||||
assertThat(msg, response.getTimestamp(), Matchers.greaterThan(946681200000L)); // 1 Jan 2000
|
||||
assertThat(msg, response.indicesStats.getStore().getSizeInBytes(), Matchers.greaterThan(0L));
|
||||
|
||||
assertThat(msg, response.nodesStats.getFs().getTotal().bytes(), Matchers.greaterThan(0l));
|
||||
assertThat(msg, response.nodesStats.getFs().getTotal().bytes(), Matchers.greaterThan(0L));
|
||||
assertThat(msg, response.nodesStats.getJvm().getVersions().size(), Matchers.greaterThan(0));
|
||||
|
||||
assertThat(msg, response.nodesStats.getVersions().size(), Matchers.greaterThan(0));
|
||||
|
|
|
@ -54,7 +54,7 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
public class CreateIndexIT extends ESIntegTestCase {
|
||||
public void testCreationDateGivenFails() {
|
||||
try {
|
||||
prepareCreate("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_CREATION_DATE, 4l)).get();
|
||||
prepareCreate("test").setSettings(Settings.builder().put(IndexMetaData.SETTING_CREATION_DATE, 4L)).get();
|
||||
fail();
|
||||
} catch (IllegalArgumentException ex) {
|
||||
assertEquals("unknown setting [index.creation_date]", ex.getMessage());
|
||||
|
|
|
@ -93,7 +93,7 @@ public class IndicesShardStoreRequestIT extends ESIntegTestCase {
|
|||
assertThat(shardStores.values().size(), equalTo(2));
|
||||
for (ObjectCursor<List<IndicesShardStoresResponse.StoreStatus>> shardStoreStatuses : shardStores.values()) {
|
||||
for (IndicesShardStoresResponse.StoreStatus storeStatus : shardStoreStatuses.value) {
|
||||
assertThat(storeStatus.getVersion(), greaterThan(-1l));
|
||||
assertThat(storeStatus.getVersion(), greaterThan(-1L));
|
||||
assertThat(storeStatus.getAllocationId(), notNullValue());
|
||||
assertThat(storeStatus.getNode(), notNullValue());
|
||||
assertThat(storeStatus.getStoreException(), nullValue());
|
||||
|
@ -191,10 +191,10 @@ public class IndicesShardStoreRequestIT extends ESIntegTestCase {
|
|||
for (IndicesShardStoresResponse.StoreStatus status : shardStatus.value) {
|
||||
if (corruptedShardIDMap.containsKey(shardStatus.key)
|
||||
&& corruptedShardIDMap.get(shardStatus.key).contains(status.getNode().name())) {
|
||||
assertThat(status.getVersion(), greaterThanOrEqualTo(0l));
|
||||
assertThat(status.getVersion(), greaterThanOrEqualTo(0L));
|
||||
assertThat(status.getStoreException(), notNullValue());
|
||||
} else {
|
||||
assertThat(status.getVersion(), greaterThanOrEqualTo(0l));
|
||||
assertThat(status.getVersion(), greaterThanOrEqualTo(0L));
|
||||
assertNull(status.getStoreException());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,11 +66,11 @@ public class IndicesStatsTests extends ESSingleNodeTestCase {
|
|||
|
||||
IndicesStatsResponse rsp = client().admin().indices().prepareStats("test").get();
|
||||
SegmentsStats stats = rsp.getIndex("test").getTotal().getSegments();
|
||||
assertThat(stats.getTermsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getStoredFieldsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTermVectorsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getNormsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getDocValuesMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTermsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getStoredFieldsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTermVectorsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getNormsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getDocValuesMemoryInBytes(), greaterThan(0L));
|
||||
|
||||
// now check multiple segments stats are merged together
|
||||
client().prepareIndex("test", "doc", "2").setSource("foo", "bar").get();
|
||||
|
@ -93,7 +93,7 @@ public class IndicesStatsTests extends ESSingleNodeTestCase {
|
|||
for (ShardStats shardStats : rsp.getIndex("test").getShards()) {
|
||||
final CommitStats commitStats = shardStats.getCommitStats();
|
||||
assertNotNull(commitStats);
|
||||
assertThat(commitStats.getGeneration(), greaterThan(0l));
|
||||
assertThat(commitStats.getGeneration(), greaterThan(0L));
|
||||
assertThat(commitStats.getId(), notNullValue());
|
||||
assertThat(commitStats.getUserData(), hasKey(Translog.TRANSLOG_GENERATION_KEY));
|
||||
assertThat(commitStats.getUserData(), hasKey(Translog.TRANSLOG_UUID_KEY));
|
||||
|
|
|
@ -99,7 +99,7 @@ public class GetTermVectorsCheckDocFreqIT extends ESIntegTestCase {
|
|||
Fields fields = response.getFields();
|
||||
assertThat(fields.size(), equalTo(1));
|
||||
Terms terms = fields.terms("field");
|
||||
assertThat(terms.size(), equalTo(8l));
|
||||
assertThat(terms.size(), equalTo(8L));
|
||||
assertThat(terms.getSumTotalTermFreq(), Matchers.equalTo((long) -1));
|
||||
assertThat(terms.getDocCount(), Matchers.equalTo(-1));
|
||||
assertThat(terms.getSumDocFreq(), equalTo((long) -1));
|
||||
|
@ -158,7 +158,7 @@ public class GetTermVectorsCheckDocFreqIT extends ESIntegTestCase {
|
|||
Fields fields = response.getFields();
|
||||
assertThat(fields.size(), equalTo(1));
|
||||
Terms terms = fields.terms("field");
|
||||
assertThat(terms.size(), equalTo(8l));
|
||||
assertThat(terms.size(), equalTo(8L));
|
||||
assertThat(terms.getSumTotalTermFreq(), Matchers.equalTo((long) (9 * numDocs)));
|
||||
assertThat(terms.getDocCount(), Matchers.equalTo(numDocs));
|
||||
assertThat(terms.getSumDocFreq(), equalTo((long) numDocs * values.length));
|
||||
|
@ -214,7 +214,7 @@ public class GetTermVectorsCheckDocFreqIT extends ESIntegTestCase {
|
|||
Fields fields = response.getFields();
|
||||
assertThat(fields.size(), equalTo(1));
|
||||
Terms terms = fields.terms("field");
|
||||
assertThat(terms.size(), equalTo(8l));
|
||||
assertThat(terms.size(), equalTo(8L));
|
||||
assertThat(terms.getSumTotalTermFreq(), Matchers.equalTo((long) (9 * numDocs)));
|
||||
assertThat(terms.getDocCount(), Matchers.equalTo(numDocs));
|
||||
assertThat(terms.getSumDocFreq(), equalTo((long) numDocs * values.length));
|
||||
|
|
|
@ -317,7 +317,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
assertThat(fields.size(), equalTo(ft.storeTermVectors() ? 1 : 0));
|
||||
if (ft.storeTermVectors()) {
|
||||
Terms terms = fields.terms("field");
|
||||
assertThat(terms.size(), equalTo(8l));
|
||||
assertThat(terms.size(), equalTo(8L));
|
||||
TermsEnum iterator = terms.iterator();
|
||||
for (int j = 0; j < values.length; j++) {
|
||||
String string = values[j];
|
||||
|
@ -637,7 +637,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
int[][] endOffset = {{15}, {43}, {19}, {25}, {39}, {30}, {9}, {3, 34}};
|
||||
|
||||
Terms terms = fields.terms(fieldName);
|
||||
assertThat(terms.size(), equalTo(8l));
|
||||
assertThat(terms.size(), equalTo(8L));
|
||||
TermsEnum iterator = terms.iterator();
|
||||
for (int j = 0; j < values.length; j++) {
|
||||
String string = values[j];
|
||||
|
@ -1087,12 +1087,12 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
response = client().prepareTermVectors(indexOrAlias(), "type1", "1").setVersion(Versions.MATCH_ANY).get();
|
||||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
|
||||
response = client().prepareTermVectors(indexOrAlias(), "type1", "1").setVersion(1).get();
|
||||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
|
||||
try {
|
||||
client().prepareGet(indexOrAlias(), "type1", "1").setVersion(2).get();
|
||||
|
@ -1109,13 +1109,13 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
|
||||
response = client().prepareTermVectors(indexOrAlias(), "type1", "1").setVersion(1).setRealtime(false).get();
|
||||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
|
||||
try {
|
||||
client().prepareGet(indexOrAlias(), "type1", "1").setVersion(2).setRealtime(false).get();
|
||||
|
@ -1134,7 +1134,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(2l));
|
||||
assertThat(response.getVersion(), equalTo(2L));
|
||||
|
||||
try {
|
||||
client().prepareGet(indexOrAlias(), "type1", "1").setVersion(1).get();
|
||||
|
@ -1147,7 +1147,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(2l));
|
||||
assertThat(response.getVersion(), equalTo(2L));
|
||||
|
||||
// From Lucene index:
|
||||
refresh();
|
||||
|
@ -1157,7 +1157,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(2l));
|
||||
assertThat(response.getVersion(), equalTo(2L));
|
||||
|
||||
try {
|
||||
client().prepareGet(indexOrAlias(), "type1", "1").setVersion(1).setRealtime(false).get();
|
||||
|
@ -1170,7 +1170,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(2l));
|
||||
assertThat(response.getVersion(), equalTo(2L));
|
||||
}
|
||||
|
||||
public void testFilterLength() throws ExecutionException, InterruptedException, IOException {
|
||||
|
|
|
@ -58,7 +58,7 @@ public class BroadcastActionsIT extends ESIntegTestCase {
|
|||
SearchResponse countResponse = client().prepareSearch("test").setSize(0)
|
||||
.setQuery(termQuery("_type", "type1"))
|
||||
.get();
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(2L));
|
||||
assertThat(countResponse.getTotalShards(), equalTo(numShards.numPrimaries));
|
||||
assertThat(countResponse.getSuccessfulShards(), equalTo(numShards.numPrimaries));
|
||||
assertThat(countResponse.getFailedShards(), equalTo(0));
|
||||
|
|
|
@ -122,11 +122,11 @@ public class BasicBackwardsCompatibilityIT extends ESBackcompatTestCase {
|
|||
assertThat(id, client().prepareIndex("test", "type1", id).setRouting(routingKey).setSource("field1", English.intToEnglish(i)).get().isCreated(), is(true));
|
||||
GetResponse get = client().prepareGet("test", "type1", id).setRouting(routingKey).setVersion(1).get();
|
||||
assertThat("Document with ID " + id + " should exist but doesn't", get.isExists(), is(true));
|
||||
assertThat(get.getVersion(), equalTo(1l));
|
||||
assertThat(get.getVersion(), equalTo(1L));
|
||||
client().prepareIndex("test", "type1", id).setRouting(routingKey).setSource("field1", English.intToEnglish(i)).execute().actionGet();
|
||||
get = client().prepareGet("test", "type1", id).setRouting(routingKey).setVersion(2).get();
|
||||
assertThat("Document with ID " + id + " should exist but doesn't", get.isExists(), is(true));
|
||||
assertThat(get.getVersion(), equalTo(2l));
|
||||
assertThat(get.getVersion(), equalTo(2L));
|
||||
}
|
||||
|
||||
assertVersionCreated(compatibilityVersion(), "test");
|
||||
|
@ -416,30 +416,30 @@ public class BasicBackwardsCompatibilityIT extends ESBackcompatTestCase {
|
|||
client().prepareIndex(indexName, "type1", "4").setSource(jsonBuilder().startObject().startObject("obj2").field("obj2_val", "1").endObject().field("y2", "y_2").field("field3", "value3_4").endObject()));
|
||||
|
||||
SearchResponse countResponse = client().prepareSearch().setSize(0).setQuery(existsQuery("field1")).get();
|
||||
assertHitCount(countResponse, 2l);
|
||||
assertHitCount(countResponse, 2L);
|
||||
|
||||
countResponse = client().prepareSearch().setSize(0).setQuery(constantScoreQuery(existsQuery("field1"))).get();
|
||||
assertHitCount(countResponse, 2l);
|
||||
assertHitCount(countResponse, 2L);
|
||||
|
||||
countResponse = client().prepareSearch().setSize(0).setQuery(queryStringQuery("_exists_:field1")).get();
|
||||
assertHitCount(countResponse, 2l);
|
||||
assertHitCount(countResponse, 2L);
|
||||
|
||||
countResponse = client().prepareSearch().setSize(0).setQuery(existsQuery("field2")).get();
|
||||
assertHitCount(countResponse, 2l);
|
||||
assertHitCount(countResponse, 2L);
|
||||
|
||||
countResponse = client().prepareSearch().setSize(0).setQuery(existsQuery("field3")).get();
|
||||
assertHitCount(countResponse, 1l);
|
||||
assertHitCount(countResponse, 1L);
|
||||
|
||||
// wildcard check
|
||||
countResponse = client().prepareSearch().setSize(0).setQuery(existsQuery("x*")).get();
|
||||
assertHitCount(countResponse, 2l);
|
||||
assertHitCount(countResponse, 2L);
|
||||
|
||||
// object check
|
||||
countResponse = client().prepareSearch().setSize(0).setQuery(existsQuery("obj1")).get();
|
||||
assertHitCount(countResponse, 2l);
|
||||
assertHitCount(countResponse, 2L);
|
||||
|
||||
countResponse = client().prepareSearch().setSize(0).setQuery(queryStringQuery("_missing_:field1")).get();
|
||||
assertHitCount(countResponse, 2l);
|
||||
assertHitCount(countResponse, 2L);
|
||||
|
||||
if (!backwardsCluster().upgradeOneNode()) {
|
||||
break;
|
||||
|
@ -598,7 +598,7 @@ public class BasicBackwardsCompatibilityIT extends ESBackcompatTestCase {
|
|||
assertThat(termVectorsResponse.isExists(), equalTo(true));
|
||||
Fields fields = termVectorsResponse.getFields();
|
||||
assertThat(fields.size(), equalTo(1));
|
||||
assertThat(fields.terms("field").size(), equalTo(8l));
|
||||
assertThat(fields.terms("field").size(), equalTo(8L));
|
||||
}
|
||||
|
||||
public void testIndicesStats() {
|
||||
|
|
|
@ -332,7 +332,7 @@ public class OldIndexBackwardsCompatibilityIT extends ESIntegTestCase {
|
|||
}
|
||||
}
|
||||
SearchResponse test = client().prepareSearch(indexName).get();
|
||||
assertThat(test.getHits().getTotalHits(), greaterThanOrEqualTo(1l));
|
||||
assertThat(test.getHits().getTotalHits(), greaterThanOrEqualTo(1L));
|
||||
}
|
||||
|
||||
void assertBasicSearchWorks(String indexName) {
|
||||
|
|
|
@ -49,7 +49,7 @@ public class StaticIndexBackwardCompatibilityIT extends ESIntegTestCase {
|
|||
assertEquals(index, getIndexResponse.indices()[0]);
|
||||
ensureYellow(index);
|
||||
SearchResponse test = client().prepareSearch(index).get();
|
||||
assertThat(test.getHits().getTotalHits(), greaterThanOrEqualTo(1l));
|
||||
assertThat(test.getHits().getTotalHits(), greaterThanOrEqualTo(1L));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -632,7 +632,7 @@ public class ClusterServiceIT extends ESIntegTestCase {
|
|||
controlSources = new HashSet<>(Arrays.asList("1", "2", "3", "4", "5"));
|
||||
for (PendingClusterTask task : response) {
|
||||
if (controlSources.remove(task.getSource().string())) {
|
||||
assertThat(task.getTimeInQueueInMillis(), greaterThan(0l));
|
||||
assertThat(task.getTimeInQueueInMillis(), greaterThan(0L));
|
||||
}
|
||||
}
|
||||
assertTrue(controlSources.isEmpty());
|
||||
|
|
|
@ -115,8 +115,8 @@ public class DiskUsageTests extends ESTestCase {
|
|||
assertEquals(2, shardSizes.size());
|
||||
assertTrue(shardSizes.containsKey(ClusterInfo.shardIdentifierFromRouting(test_0)));
|
||||
assertTrue(shardSizes.containsKey(ClusterInfo.shardIdentifierFromRouting(test_1)));
|
||||
assertEquals(100l, shardSizes.get(ClusterInfo.shardIdentifierFromRouting(test_0)).longValue());
|
||||
assertEquals(1000l, shardSizes.get(ClusterInfo.shardIdentifierFromRouting(test_1)).longValue());
|
||||
assertEquals(100L, shardSizes.get(ClusterInfo.shardIdentifierFromRouting(test_0)).longValue());
|
||||
assertEquals(1000L, shardSizes.get(ClusterInfo.shardIdentifierFromRouting(test_1)).longValue());
|
||||
|
||||
assertEquals(2, routingToPath.size());
|
||||
assertTrue(routingToPath.containsKey(test_0));
|
||||
|
|
|
@ -117,7 +117,7 @@ public class MinimumMasterNodesIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> verify we the data back");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(100l));
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(100L));
|
||||
}
|
||||
|
||||
internalCluster().stopCurrentMasterNode();
|
||||
|
|
|
@ -248,10 +248,10 @@ public class NoMasterNodeIT extends ESIntegTestCase {
|
|||
assertExists(getResponse);
|
||||
|
||||
SearchResponse countResponse = client().prepareSearch("test1").setSize(0).get();
|
||||
assertHitCount(countResponse, 1l);
|
||||
assertHitCount(countResponse, 1L);
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("test1").get();
|
||||
assertHitCount(searchResponse, 1l);
|
||||
assertHitCount(searchResponse, 1L);
|
||||
|
||||
countResponse = client().prepareSearch("test2").setSize(0).get();
|
||||
assertThat(countResponse.getTotalShards(), equalTo(2));
|
||||
|
|
|
@ -58,7 +58,7 @@ public class FilteringAllocationIT extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value" + i).execute().actionGet();
|
||||
}
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(100l));
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(100L));
|
||||
|
||||
logger.info("--> decommission the second node");
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
|
@ -77,7 +77,7 @@ public class FilteringAllocationIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(100l));
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(100L));
|
||||
}
|
||||
|
||||
public void testDisablingAllocationFiltering() throws Exception {
|
||||
|
@ -99,7 +99,7 @@ public class FilteringAllocationIT extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value" + i).execute().actionGet();
|
||||
}
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(100l));
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(100L));
|
||||
ClusterState clusterState = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
IndexRoutingTable indexRoutingTable = clusterState.routingTable().index("test");
|
||||
int numShardsOnNode1 = 0;
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
.settings(settings(Version.CURRENT))
|
||||
.numberOfShards(1)
|
||||
.numberOfReplicas(2)
|
||||
.creationDate(2l))
|
||||
.creationDate(2L))
|
||||
.put(IndexMetaData.builder("test5")
|
||||
.settings(settings(Version.CURRENT).put("setting1", "value1").put("setting2", "value2"))
|
||||
.numberOfShards(1)
|
||||
|
@ -66,12 +66,12 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
.settings(settings(Version.CURRENT).put("setting1", "value1").put("setting2", "value2"))
|
||||
.numberOfShards(1)
|
||||
.numberOfReplicas(2)
|
||||
.creationDate(2l))
|
||||
.creationDate(2L))
|
||||
.put(IndexMetaData.builder("test7")
|
||||
.settings(settings(Version.CURRENT))
|
||||
.numberOfShards(1)
|
||||
.numberOfReplicas(2)
|
||||
.creationDate(2l)
|
||||
.creationDate(2L)
|
||||
.putMapping("mapping1", MAPPING_SOURCE1)
|
||||
.putMapping("mapping2", MAPPING_SOURCE2))
|
||||
.put(IndexMetaData.builder("test8")
|
||||
|
@ -84,7 +84,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
.putAlias(newAliasMetaDataBuilder("alias2")))
|
||||
.put(IndexMetaData.builder("test9")
|
||||
.settings(settings(Version.CURRENT).put("setting1", "value1").put("setting2", "value2"))
|
||||
.creationDate(2l)
|
||||
.creationDate(2L)
|
||||
.numberOfShards(1)
|
||||
.numberOfReplicas(2)
|
||||
.putMapping("mapping1", MAPPING_SOURCE1)
|
||||
|
@ -125,7 +125,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
.settings(settings(Version.CURRENT)
|
||||
.put("setting1", "value1")
|
||||
.put("setting2", "value2"))
|
||||
.creationDate(2l)
|
||||
.creationDate(2L)
|
||||
.numberOfShards(1)
|
||||
.numberOfReplicas(2)
|
||||
.putMapping("mapping1", MAPPING_SOURCE1)
|
||||
|
@ -152,14 +152,14 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
IndexMetaData indexMetaData = parsedMetaData.index("test1");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(3));
|
||||
assertThat(indexMetaData.getMappings().size(), equalTo(0));
|
||||
|
||||
indexMetaData = parsedMetaData.index("test2");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(2));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(3));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(5));
|
||||
assertThat(indexMetaData.getSettings().get("setting1"), equalTo("value1"));
|
||||
assertThat(indexMetaData.getSettings().get("setting2"), equalTo("value2"));
|
||||
|
@ -168,13 +168,13 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
indexMetaData = parsedMetaData.index("test3");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(3));
|
||||
assertThat(indexMetaData.getMappings().size(), equalTo(1));
|
||||
assertThat(indexMetaData.getMappings().get("mapping1").source().string(), equalTo(MAPPING_SOURCE1));
|
||||
|
||||
indexMetaData = parsedMetaData.index("test4");
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2L));
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(4));
|
||||
|
@ -183,7 +183,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
indexMetaData = parsedMetaData.index("test5");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(5));
|
||||
assertThat(indexMetaData.getSettings().get("setting1"), equalTo("value1"));
|
||||
assertThat(indexMetaData.getSettings().get("setting2"), equalTo("value2"));
|
||||
|
@ -194,7 +194,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
indexMetaData = parsedMetaData.index("test6");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(6));
|
||||
assertThat(indexMetaData.getSettings().get("setting1"), equalTo("value1"));
|
||||
assertThat(indexMetaData.getSettings().get("setting2"), equalTo("value2"));
|
||||
|
@ -203,7 +203,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
indexMetaData = parsedMetaData.index("test7");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(4));
|
||||
assertThat(indexMetaData.getMappings().size(), equalTo(2));
|
||||
assertThat(indexMetaData.getMappings().get("mapping1").source().string(), equalTo(MAPPING_SOURCE1));
|
||||
|
@ -212,7 +212,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
indexMetaData = parsedMetaData.index("test8");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(5));
|
||||
assertThat(indexMetaData.getSettings().get("setting1"), equalTo("value1"));
|
||||
assertThat(indexMetaData.getSettings().get("setting2"), equalTo("value2"));
|
||||
|
@ -226,7 +226,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
indexMetaData = parsedMetaData.index("test9");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(6));
|
||||
assertThat(indexMetaData.getSettings().get("setting1"), equalTo("value1"));
|
||||
assertThat(indexMetaData.getSettings().get("setting2"), equalTo("value2"));
|
||||
|
@ -240,7 +240,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
indexMetaData = parsedMetaData.index("test10");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(5));
|
||||
assertThat(indexMetaData.getSettings().get("setting1"), equalTo("value1"));
|
||||
assertThat(indexMetaData.getSettings().get("setting2"), equalTo("value2"));
|
||||
|
@ -254,7 +254,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
indexMetaData = parsedMetaData.index("test11");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(-1L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(5));
|
||||
assertThat(indexMetaData.getSettings().get("setting1"), equalTo("value1"));
|
||||
assertThat(indexMetaData.getSettings().get("setting2"), equalTo("value2"));
|
||||
|
@ -272,7 +272,7 @@ public class ToAndFromJsonMetaDataTests extends ESTestCase {
|
|||
indexMetaData = parsedMetaData.index("test12");
|
||||
assertThat(indexMetaData.getNumberOfShards(), equalTo(1));
|
||||
assertThat(indexMetaData.getNumberOfReplicas(), equalTo(2));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2l));
|
||||
assertThat(indexMetaData.getCreationDate(), equalTo(2L));
|
||||
assertThat(indexMetaData.getSettings().getAsMap().size(), equalTo(6));
|
||||
assertThat(indexMetaData.getSettings().get("setting1"), equalTo("value1"));
|
||||
assertThat(indexMetaData.getSettings().get("setting2"), equalTo("value2"));
|
||||
|
|
|
@ -122,7 +122,7 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> check that the up-to-date primary shard gets promoted and that documents are available");
|
||||
ensureYellow("test");
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2l);
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2L);
|
||||
}
|
||||
|
||||
public void testFailedAllocationOfStalePrimaryToDataNodeWithNoData() throws Exception {
|
||||
|
@ -171,7 +171,7 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
|
|||
logger.info("--> check that the stale primary shard gets allocated and that documents are available");
|
||||
ensureYellow("test");
|
||||
|
||||
assertHitCount(client().prepareSearch("test").setSize(0).setQuery(matchAllQuery()).get(), useStaleReplica ? 1l : 0l);
|
||||
assertHitCount(client().prepareSearch("test").setSize(0).setQuery(matchAllQuery()).get(), useStaleReplica ? 1L : 0L);
|
||||
}
|
||||
|
||||
public void testForcePrimaryShardIfAllocationDecidersSayNoAfterIndexCreation() throws ExecutionException, InterruptedException {
|
||||
|
@ -200,6 +200,6 @@ public class PrimaryAllocationIT extends ESIntegTestCase {
|
|||
internalCluster().fullRestart();
|
||||
logger.info("--> checking that index still gets allocated with only 1 shard copy being available");
|
||||
ensureYellow("test");
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 1l);
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 1L);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ public class UnassignedInfoTests extends ESAllocationTestCase {
|
|||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).size(), equalTo(1));
|
||||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).get(0).unassignedInfo(), notNullValue());
|
||||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).get(0).unassignedInfo().getReason(), equalTo(UnassignedInfo.Reason.NODE_LEFT));
|
||||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).get(0).unassignedInfo().getUnassignedTimeInMillis(), greaterThan(0l));
|
||||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).get(0).unassignedInfo().getUnassignedTimeInMillis(), greaterThan(0L));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,7 +252,7 @@ public class UnassignedInfoTests extends ESAllocationTestCase {
|
|||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).get(0).unassignedInfo().getReason(), equalTo(UnassignedInfo.Reason.ALLOCATION_FAILED));
|
||||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).get(0).unassignedInfo().getMessage(), equalTo("test fail"));
|
||||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).get(0).unassignedInfo().getDetails(), equalTo("test fail"));
|
||||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).get(0).unassignedInfo().getUnassignedTimeInMillis(), greaterThan(0l));
|
||||
assertThat(clusterState.getRoutingNodes().shardsWithState(UNASSIGNED).get(0).unassignedInfo().getUnassignedTimeInMillis(), greaterThan(0L));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -276,9 +276,9 @@ public class UnassignedInfoTests extends ESAllocationTestCase {
|
|||
UnassignedInfo unassignedInfo = new UnassignedInfo(RandomPicks.randomFrom(getRandom(), reasons), null);
|
||||
long delay = unassignedInfo.updateDelay(unassignedInfo.getUnassignedTimeInNanos() + 1, // add 1 tick delay
|
||||
Settings.builder().put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), "10h").build(), Settings.EMPTY);
|
||||
assertThat(delay, equalTo(0l));
|
||||
assertThat(delay, equalTo(0L));
|
||||
delay = unassignedInfo.getLastComputedLeftDelayNanos();
|
||||
assertThat(delay, equalTo(0l));
|
||||
assertThat(delay, equalTo(0L));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -64,14 +64,14 @@ public class ShardVersioningTests extends ESAllocationTestCase {
|
|||
for (int i = 0; i < routingTable.index("test1").shards().size(); i++) {
|
||||
assertThat(routingTable.index("test1").shard(i).shards().size(), equalTo(2));
|
||||
assertThat(routingTable.index("test1").shard(i).primaryShard().state(), equalTo(INITIALIZING));
|
||||
assertThat(routingTable.index("test1").shard(i).primaryShard().version(), equalTo(1l));
|
||||
assertThat(routingTable.index("test1").shard(i).primaryShard().version(), equalTo(1L));
|
||||
assertThat(routingTable.index("test1").shard(i).replicaShards().get(0).state(), equalTo(UNASSIGNED));
|
||||
}
|
||||
|
||||
for (int i = 0; i < routingTable.index("test2").shards().size(); i++) {
|
||||
assertThat(routingTable.index("test2").shard(i).shards().size(), equalTo(2));
|
||||
assertThat(routingTable.index("test2").shard(i).primaryShard().state(), equalTo(INITIALIZING));
|
||||
assertThat(routingTable.index("test2").shard(i).primaryShard().version(), equalTo(1l));
|
||||
assertThat(routingTable.index("test2").shard(i).primaryShard().version(), equalTo(1L));
|
||||
assertThat(routingTable.index("test2").shard(i).replicaShards().get(0).state(), equalTo(UNASSIGNED));
|
||||
}
|
||||
|
||||
|
@ -84,17 +84,17 @@ public class ShardVersioningTests extends ESAllocationTestCase {
|
|||
for (int i = 0; i < routingTable.index("test1").shards().size(); i++) {
|
||||
assertThat(routingTable.index("test1").shard(i).shards().size(), equalTo(2));
|
||||
assertThat(routingTable.index("test1").shard(i).primaryShard().state(), equalTo(STARTED));
|
||||
assertThat(routingTable.index("test1").shard(i).primaryShard().version(), equalTo(2l));
|
||||
assertThat(routingTable.index("test1").shard(i).primaryShard().version(), equalTo(2L));
|
||||
assertThat(routingTable.index("test1").shard(i).replicaShards().get(0).state(), equalTo(INITIALIZING));
|
||||
assertThat(routingTable.index("test1").shard(i).replicaShards().get(0).version(), equalTo(2l));
|
||||
assertThat(routingTable.index("test1").shard(i).replicaShards().get(0).version(), equalTo(2L));
|
||||
}
|
||||
|
||||
for (int i = 0; i < routingTable.index("test2").shards().size(); i++) {
|
||||
assertThat(routingTable.index("test2").shard(i).shards().size(), equalTo(2));
|
||||
assertThat(routingTable.index("test2").shard(i).primaryShard().state(), equalTo(INITIALIZING));
|
||||
assertThat(routingTable.index("test2").shard(i).primaryShard().version(), equalTo(1l));
|
||||
assertThat(routingTable.index("test2").shard(i).primaryShard().version(), equalTo(1L));
|
||||
assertThat(routingTable.index("test2").shard(i).replicaShards().get(0).state(), equalTo(UNASSIGNED));
|
||||
assertThat(routingTable.index("test2").shard(i).replicaShards().get(0).version(), equalTo(1l));
|
||||
assertThat(routingTable.index("test2").shard(i).replicaShards().get(0).version(), equalTo(1L));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -239,20 +239,20 @@ public class DiskThresholdDeciderUnitTests extends ESTestCase {
|
|||
ShardRoutingHelper.initialize(test_2, "node1");
|
||||
ShardRoutingHelper.moveToStarted(test_2);
|
||||
|
||||
assertEquals(1000l, DiskThresholdDecider.getShardSize(test_2, info));
|
||||
assertEquals(100l, DiskThresholdDecider.getShardSize(test_1, info));
|
||||
assertEquals(10l, DiskThresholdDecider.getShardSize(test_0, info));
|
||||
assertEquals(1000L, DiskThresholdDecider.getShardSize(test_2, info));
|
||||
assertEquals(100L, DiskThresholdDecider.getShardSize(test_1, info));
|
||||
assertEquals(10L, DiskThresholdDecider.getShardSize(test_0, info));
|
||||
|
||||
RoutingNode node = new RoutingNode("node1", new DiscoveryNode("node1", LocalTransportAddress.PROTO, Version.CURRENT), Arrays.asList(test_0, test_1.buildTargetRelocatingShard(), test_2));
|
||||
assertEquals(100l, DiskThresholdDecider.sizeOfRelocatingShards(node, info, false, "/dev/null"));
|
||||
assertEquals(90l, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/null"));
|
||||
assertEquals(0l, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/some/other/dev"));
|
||||
assertEquals(0l, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/some/other/dev"));
|
||||
assertEquals(100L, DiskThresholdDecider.sizeOfRelocatingShards(node, info, false, "/dev/null"));
|
||||
assertEquals(90L, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/null"));
|
||||
assertEquals(0L, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/some/other/dev"));
|
||||
assertEquals(0L, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/some/other/dev"));
|
||||
|
||||
ShardRouting test_3 = ShardRouting.newUnassigned(index, 3, null, false, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo"));
|
||||
ShardRoutingHelper.initialize(test_3, "node1");
|
||||
ShardRoutingHelper.moveToStarted(test_3);
|
||||
assertEquals(0l, DiskThresholdDecider.getShardSize(test_3, info));
|
||||
assertEquals(0L, DiskThresholdDecider.getShardSize(test_3, info));
|
||||
|
||||
|
||||
ShardRouting other_0 = ShardRouting.newUnassigned(new Index("other", "_NA_"), 0, null, randomBoolean(), new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo"));
|
||||
|
@ -263,11 +263,11 @@ public class DiskThresholdDeciderUnitTests extends ESTestCase {
|
|||
|
||||
node = new RoutingNode("node1", new DiscoveryNode("node1", LocalTransportAddress.PROTO, Version.CURRENT), Arrays.asList(test_0, test_1.buildTargetRelocatingShard(), test_2, other_0.buildTargetRelocatingShard()));
|
||||
if (other_0.primary()) {
|
||||
assertEquals(10100l, DiskThresholdDecider.sizeOfRelocatingShards(node, info, false, "/dev/null"));
|
||||
assertEquals(10090l, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/null"));
|
||||
assertEquals(10100L, DiskThresholdDecider.sizeOfRelocatingShards(node, info, false, "/dev/null"));
|
||||
assertEquals(10090L, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/null"));
|
||||
} else {
|
||||
assertEquals(100l, DiskThresholdDecider.sizeOfRelocatingShards(node, info, false, "/dev/null"));
|
||||
assertEquals(90l, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/null"));
|
||||
assertEquals(100L, DiskThresholdDecider.sizeOfRelocatingShards(node, info, false, "/dev/null"));
|
||||
assertEquals(90L, DiskThresholdDecider.sizeOfRelocatingShards(node, info, true, "/dev/null"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class ClusterSettingsIT extends ESIntegTestCase {
|
|||
|
||||
assertAcked(response);
|
||||
assertThat(response.getTransientSettings().getAsMap().get(DiscoverySettings.PUBLISH_TIMEOUT_SETTING.getKey()), equalTo("1s"));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1l));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1L));
|
||||
assertThat(discoverySettings.getPublishDiff(), equalTo(DiscoverySettings.PUBLISH_DIFF_ENABLE_SETTING.get(Settings.EMPTY)));
|
||||
|
||||
|
||||
|
@ -118,7 +118,7 @@ public class ClusterSettingsIT extends ESIntegTestCase {
|
|||
|
||||
assertAcked(response);
|
||||
assertThat(response.getTransientSettings().getAsMap().get(DiscoverySettings.PUBLISH_TIMEOUT_SETTING.getKey()), equalTo("1s"));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1l));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1L));
|
||||
assertFalse(discoverySettings.getPublishDiff());
|
||||
response = client().admin().cluster()
|
||||
.prepareUpdateSettings()
|
||||
|
@ -138,7 +138,7 @@ public class ClusterSettingsIT extends ESIntegTestCase {
|
|||
|
||||
assertAcked(response);
|
||||
assertThat(response.getPersistentSettings().getAsMap().get(DiscoverySettings.PUBLISH_TIMEOUT_SETTING.getKey()), equalTo("1s"));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1l));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1L));
|
||||
assertThat(discoverySettings.getPublishDiff(), equalTo(DiscoverySettings.PUBLISH_DIFF_ENABLE_SETTING.get(Settings.EMPTY)));
|
||||
|
||||
|
||||
|
@ -162,7 +162,7 @@ public class ClusterSettingsIT extends ESIntegTestCase {
|
|||
|
||||
assertAcked(response);
|
||||
assertThat(response.getPersistentSettings().getAsMap().get(DiscoverySettings.PUBLISH_TIMEOUT_SETTING.getKey()), equalTo("1s"));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1l));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1L));
|
||||
assertFalse(discoverySettings.getPublishDiff());
|
||||
response = client().admin().cluster()
|
||||
.prepareUpdateSettings()
|
||||
|
@ -254,7 +254,7 @@ public class ClusterSettingsIT extends ESIntegTestCase {
|
|||
|
||||
assertAcked(response);
|
||||
assertThat(response.getTransientSettings().getAsMap().get(DiscoverySettings.PUBLISH_TIMEOUT_SETTING.getKey()), equalTo("1s"));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1l));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1L));
|
||||
|
||||
try {
|
||||
client().admin().cluster()
|
||||
|
@ -266,7 +266,7 @@ public class ClusterSettingsIT extends ESIntegTestCase {
|
|||
assertEquals(ex.getMessage(), "Failed to parse setting [discovery.zen.publish_timeout] with value [whatever] as a time value: unit is missing or unrecognized");
|
||||
}
|
||||
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1l));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1L));
|
||||
|
||||
try {
|
||||
client().admin().cluster()
|
||||
|
@ -278,7 +278,7 @@ public class ClusterSettingsIT extends ESIntegTestCase {
|
|||
assertEquals(ex.getMessage(), "Failed to parse value [-1] for setting [discovery.zen.publish_timeout] must be >= 0s");
|
||||
}
|
||||
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1l));
|
||||
assertThat(discoverySettings.getPublishTimeout().seconds(), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testClusterUpdateSettingsWithBlocks() {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class MoreLikeThisQueryTests extends ESTestCase {
|
|||
mltQuery.setMinTermFrequency(1);
|
||||
mltQuery.setMinDocFreq(1);
|
||||
long count = searcher.count(mltQuery);
|
||||
assertThat(count, equalTo(2l));
|
||||
assertThat(count, equalTo(2L));
|
||||
|
||||
reader.close();
|
||||
indexWriter.close();
|
||||
|
|
|
@ -51,7 +51,7 @@ public class InputStreamIndexInputTests extends ESTestCase {
|
|||
for (int i = 0; i < 3; i++) {
|
||||
InputStreamIndexInput is = new InputStreamIndexInput(input, 1);
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
assertThat(is.actualSizeToRead(), equalTo(1l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(1L));
|
||||
assertThat(is.read(), equalTo(1));
|
||||
assertThat(is.read(), equalTo(-1));
|
||||
}
|
||||
|
@ -59,14 +59,14 @@ public class InputStreamIndexInputTests extends ESTestCase {
|
|||
for (int i = 0; i < 3; i++) {
|
||||
InputStreamIndexInput is = new InputStreamIndexInput(input, 1);
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
assertThat(is.actualSizeToRead(), equalTo(1l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(1L));
|
||||
assertThat(is.read(), equalTo(2));
|
||||
assertThat(is.read(), equalTo(-1));
|
||||
}
|
||||
|
||||
assertThat(input.getFilePointer(), equalTo(input.length()));
|
||||
InputStreamIndexInput is = new InputStreamIndexInput(input, 1);
|
||||
assertThat(is.actualSizeToRead(), equalTo(0l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(0L));
|
||||
assertThat(is.read(), equalTo(-1));
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class InputStreamIndexInputTests extends ESTestCase {
|
|||
for (int i = 0; i < 3; i++) {
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
InputStreamIndexInput is = new InputStreamIndexInput(input, 1);
|
||||
assertThat(is.actualSizeToRead(), equalTo(1l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(1L));
|
||||
assertThat(is.read(read), equalTo(1));
|
||||
assertThat(read[0], equalTo((byte) 1));
|
||||
}
|
||||
|
@ -97,14 +97,14 @@ public class InputStreamIndexInputTests extends ESTestCase {
|
|||
for (int i = 0; i < 3; i++) {
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
InputStreamIndexInput is = new InputStreamIndexInput(input, 1);
|
||||
assertThat(is.actualSizeToRead(), equalTo(1l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(1L));
|
||||
assertThat(is.read(read), equalTo(1));
|
||||
assertThat(read[0], equalTo((byte) 2));
|
||||
}
|
||||
|
||||
assertThat(input.getFilePointer(), equalTo(input.length()));
|
||||
InputStreamIndexInput is = new InputStreamIndexInput(input, 1);
|
||||
assertThat(is.actualSizeToRead(), equalTo(0l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(0L));
|
||||
assertThat(is.read(read), equalTo(-1));
|
||||
}
|
||||
|
||||
|
@ -124,28 +124,28 @@ public class InputStreamIndexInputTests extends ESTestCase {
|
|||
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
InputStreamIndexInput is = new InputStreamIndexInput(input, 2);
|
||||
assertThat(is.actualSizeToRead(), equalTo(2l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(2L));
|
||||
assertThat(is.read(), equalTo(1));
|
||||
assertThat(is.read(), equalTo(1));
|
||||
assertThat(is.read(), equalTo(-1));
|
||||
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
is = new InputStreamIndexInput(input, 2);
|
||||
assertThat(is.actualSizeToRead(), equalTo(2l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(2L));
|
||||
assertThat(is.read(), equalTo(1));
|
||||
assertThat(is.read(), equalTo(2));
|
||||
assertThat(is.read(), equalTo(-1));
|
||||
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
is = new InputStreamIndexInput(input, 2);
|
||||
assertThat(is.actualSizeToRead(), equalTo(2l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(2L));
|
||||
assertThat(is.read(), equalTo(2));
|
||||
assertThat(is.read(), equalTo(2));
|
||||
assertThat(is.read(), equalTo(-1));
|
||||
|
||||
assertThat(input.getFilePointer(), equalTo(input.length()));
|
||||
is = new InputStreamIndexInput(input, 2);
|
||||
assertThat(is.actualSizeToRead(), equalTo(0l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(0L));
|
||||
assertThat(is.read(), equalTo(-1));
|
||||
}
|
||||
|
||||
|
@ -167,28 +167,28 @@ public class InputStreamIndexInputTests extends ESTestCase {
|
|||
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
InputStreamIndexInput is = new InputStreamIndexInput(input, 2);
|
||||
assertThat(is.actualSizeToRead(), equalTo(2l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(2L));
|
||||
assertThat(is.read(read), equalTo(2));
|
||||
assertThat(read[0], equalTo((byte) 1));
|
||||
assertThat(read[1], equalTo((byte) 1));
|
||||
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
is = new InputStreamIndexInput(input, 2);
|
||||
assertThat(is.actualSizeToRead(), equalTo(2l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(2L));
|
||||
assertThat(is.read(read), equalTo(2));
|
||||
assertThat(read[0], equalTo((byte) 1));
|
||||
assertThat(read[1], equalTo((byte) 2));
|
||||
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
is = new InputStreamIndexInput(input, 2);
|
||||
assertThat(is.actualSizeToRead(), equalTo(2l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(2L));
|
||||
assertThat(is.read(read), equalTo(2));
|
||||
assertThat(read[0], equalTo((byte) 2));
|
||||
assertThat(read[1], equalTo((byte) 2));
|
||||
|
||||
assertThat(input.getFilePointer(), equalTo(input.length()));
|
||||
is = new InputStreamIndexInput(input, 2);
|
||||
assertThat(is.actualSizeToRead(), equalTo(0l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(0L));
|
||||
assertThat(is.read(read), equalTo(-1));
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ public class InputStreamIndexInputTests extends ESTestCase {
|
|||
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
InputStreamIndexInput is = new InputStreamIndexInput(input, 4);
|
||||
assertThat(is.actualSizeToRead(), equalTo(4l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(4L));
|
||||
assertThat(is.read(read), equalTo(4));
|
||||
assertThat(read[0], equalTo((byte) 1));
|
||||
assertThat(read[1], equalTo((byte) 1));
|
||||
|
@ -219,14 +219,14 @@ public class InputStreamIndexInputTests extends ESTestCase {
|
|||
|
||||
assertThat(input.getFilePointer(), lessThan(input.length()));
|
||||
is = new InputStreamIndexInput(input, 4);
|
||||
assertThat(is.actualSizeToRead(), equalTo(2l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(2L));
|
||||
assertThat(is.read(read), equalTo(2));
|
||||
assertThat(read[0], equalTo((byte) 2));
|
||||
assertThat(read[1], equalTo((byte) 2));
|
||||
|
||||
assertThat(input.getFilePointer(), equalTo(input.length()));
|
||||
is = new InputStreamIndexInput(input, 4);
|
||||
assertThat(is.actualSizeToRead(), equalTo(0l));
|
||||
assertThat(is.actualSizeToRead(), equalTo(0L));
|
||||
assertThat(is.read(read), equalTo(-1));
|
||||
}
|
||||
|
||||
|
|
|
@ -93,8 +93,8 @@ public class VersionsTests extends ESTestCase {
|
|||
doc.add(new NumericDocValuesField(VersionFieldMapper.NAME, 1));
|
||||
writer.updateDocument(new Term(UidFieldMapper.NAME, "1"), doc);
|
||||
directoryReader = reopen(directoryReader);
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(1l));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(1l));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(1L));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(1L));
|
||||
|
||||
doc = new Document();
|
||||
Field uid = new Field(UidFieldMapper.NAME, "1", UidFieldMapper.Defaults.FIELD_TYPE);
|
||||
|
@ -103,8 +103,8 @@ public class VersionsTests extends ESTestCase {
|
|||
doc.add(version);
|
||||
writer.updateDocument(new Term(UidFieldMapper.NAME, "1"), doc);
|
||||
directoryReader = reopen(directoryReader);
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(2l));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(2l));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(2L));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(2L));
|
||||
|
||||
// test reuse of uid field
|
||||
doc = new Document();
|
||||
|
@ -114,8 +114,8 @@ public class VersionsTests extends ESTestCase {
|
|||
writer.updateDocument(new Term(UidFieldMapper.NAME, "1"), doc);
|
||||
|
||||
directoryReader = reopen(directoryReader);
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(3l));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(3l));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(3L));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(3L));
|
||||
|
||||
writer.deleteDocuments(new Term(UidFieldMapper.NAME, "1"));
|
||||
directoryReader = reopen(directoryReader);
|
||||
|
@ -146,16 +146,16 @@ public class VersionsTests extends ESTestCase {
|
|||
|
||||
writer.updateDocuments(new Term(UidFieldMapper.NAME, "1"), docs);
|
||||
DirectoryReader directoryReader = ElasticsearchDirectoryReader.wrap(DirectoryReader.open(writer, true), new ShardId("foo", "_na_", 1));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(5l));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(5l));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(5L));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(5L));
|
||||
|
||||
version.setLongValue(6L);
|
||||
writer.updateDocuments(new Term(UidFieldMapper.NAME, "1"), docs);
|
||||
version.setLongValue(7L);
|
||||
writer.updateDocuments(new Term(UidFieldMapper.NAME, "1"), docs);
|
||||
directoryReader = reopen(directoryReader);
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(7l));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(7l));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(7L));
|
||||
assertThat(Versions.loadDocIdAndVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")).version, equalTo(7L));
|
||||
|
||||
writer.deleteDocuments(new Term(UidFieldMapper.NAME, "1"));
|
||||
directoryReader = reopen(directoryReader);
|
||||
|
@ -184,8 +184,8 @@ public class VersionsTests extends ESTestCase {
|
|||
writer.commit();
|
||||
|
||||
directoryReader = reopen(directoryReader);
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(1l));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "2")), equalTo(2l));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "1")), equalTo(1L));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "2")), equalTo(2L));
|
||||
assertThat(Versions.loadVersion(directoryReader, new Term(UidFieldMapper.NAME, "3")), equalTo(Versions.NOT_FOUND));
|
||||
directoryReader.close();
|
||||
writer.close();
|
||||
|
|
|
@ -101,8 +101,8 @@ public class TimeZoneRoundingTests extends ESTestCase {
|
|||
int timezoneOffset = -2;
|
||||
Rounding tzRounding = TimeZoneRounding.builder(DateTimeUnit.DAY_OF_MONTH).timeZone(DateTimeZone.forOffsetHours(timezoneOffset))
|
||||
.build();
|
||||
assertThat(tzRounding.round(0), equalTo(0l - TimeValue.timeValueHours(24 + timezoneOffset).millis()));
|
||||
assertThat(tzRounding.nextRoundingValue(0l - TimeValue.timeValueHours(24 + timezoneOffset).millis()), equalTo(0l - TimeValue
|
||||
assertThat(tzRounding.round(0), equalTo(0L - TimeValue.timeValueHours(24 + timezoneOffset).millis()));
|
||||
assertThat(tzRounding.nextRoundingValue(0L - TimeValue.timeValueHours(24 + timezoneOffset).millis()), equalTo(0L - TimeValue
|
||||
.timeValueHours(timezoneOffset).millis()));
|
||||
|
||||
tzRounding = TimeZoneRounding.builder(DateTimeUnit.DAY_OF_MONTH).timeZone(DateTimeZone.forID("-08:00")).build();
|
||||
|
@ -135,8 +135,8 @@ public class TimeZoneRoundingTests extends ESTestCase {
|
|||
public void testTimeTimeZoneRounding() {
|
||||
// hour unit
|
||||
Rounding tzRounding = TimeZoneRounding.builder(DateTimeUnit.HOUR_OF_DAY).timeZone(DateTimeZone.forOffsetHours(-2)).build();
|
||||
assertThat(tzRounding.round(0), equalTo(0l));
|
||||
assertThat(tzRounding.nextRoundingValue(0l), equalTo(TimeValue.timeValueHours(1l).getMillis()));
|
||||
assertThat(tzRounding.round(0), equalTo(0L));
|
||||
assertThat(tzRounding.nextRoundingValue(0L), equalTo(TimeValue.timeValueHours(1L).getMillis()));
|
||||
|
||||
tzRounding = TimeZoneRounding.builder(DateTimeUnit.HOUR_OF_DAY).timeZone(DateTimeZone.forOffsetHours(-2)).build();
|
||||
assertThat(tzRounding.round(utc("2009-02-03T01:01:01")), equalTo(utc("2009-02-03T01:00:00")));
|
||||
|
|
|
@ -34,47 +34,47 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
*/
|
||||
public class ByteSizeUnitTests extends ESTestCase {
|
||||
public void testBytes() {
|
||||
assertThat(BYTES.toBytes(1), equalTo(1l));
|
||||
assertThat(BYTES.toKB(1024), equalTo(1l));
|
||||
assertThat(BYTES.toMB(1024 * 1024), equalTo(1l));
|
||||
assertThat(BYTES.toGB(1024 * 1024 * 1024), equalTo(1l));
|
||||
assertThat(BYTES.toBytes(1), equalTo(1L));
|
||||
assertThat(BYTES.toKB(1024), equalTo(1L));
|
||||
assertThat(BYTES.toMB(1024 * 1024), equalTo(1L));
|
||||
assertThat(BYTES.toGB(1024 * 1024 * 1024), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testKB() {
|
||||
assertThat(KB.toBytes(1), equalTo(1024l));
|
||||
assertThat(KB.toKB(1), equalTo(1l));
|
||||
assertThat(KB.toMB(1024), equalTo(1l));
|
||||
assertThat(KB.toGB(1024 * 1024), equalTo(1l));
|
||||
assertThat(KB.toBytes(1), equalTo(1024L));
|
||||
assertThat(KB.toKB(1), equalTo(1L));
|
||||
assertThat(KB.toMB(1024), equalTo(1L));
|
||||
assertThat(KB.toGB(1024 * 1024), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testMB() {
|
||||
assertThat(MB.toBytes(1), equalTo(1024l * 1024));
|
||||
assertThat(MB.toKB(1), equalTo(1024l));
|
||||
assertThat(MB.toMB(1), equalTo(1l));
|
||||
assertThat(MB.toGB(1024), equalTo(1l));
|
||||
assertThat(MB.toBytes(1), equalTo(1024L * 1024));
|
||||
assertThat(MB.toKB(1), equalTo(1024L));
|
||||
assertThat(MB.toMB(1), equalTo(1L));
|
||||
assertThat(MB.toGB(1024), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testGB() {
|
||||
assertThat(GB.toBytes(1), equalTo(1024l * 1024 * 1024));
|
||||
assertThat(GB.toKB(1), equalTo(1024l * 1024));
|
||||
assertThat(GB.toMB(1), equalTo(1024l));
|
||||
assertThat(GB.toGB(1), equalTo(1l));
|
||||
assertThat(GB.toBytes(1), equalTo(1024L * 1024 * 1024));
|
||||
assertThat(GB.toKB(1), equalTo(1024L * 1024));
|
||||
assertThat(GB.toMB(1), equalTo(1024L));
|
||||
assertThat(GB.toGB(1), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testTB() {
|
||||
assertThat(TB.toBytes(1), equalTo(1024l * 1024 * 1024 * 1024));
|
||||
assertThat(TB.toKB(1), equalTo(1024l * 1024 * 1024));
|
||||
assertThat(TB.toMB(1), equalTo(1024l * 1024));
|
||||
assertThat(TB.toGB(1), equalTo(1024l));
|
||||
assertThat(TB.toTB(1), equalTo(1l));
|
||||
assertThat(TB.toBytes(1), equalTo(1024L * 1024 * 1024 * 1024));
|
||||
assertThat(TB.toKB(1), equalTo(1024L * 1024 * 1024));
|
||||
assertThat(TB.toMB(1), equalTo(1024L * 1024));
|
||||
assertThat(TB.toGB(1), equalTo(1024L));
|
||||
assertThat(TB.toTB(1), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testPB() {
|
||||
assertThat(PB.toBytes(1), equalTo(1024l * 1024 * 1024 * 1024 * 1024));
|
||||
assertThat(PB.toKB(1), equalTo(1024l * 1024 * 1024 * 1024));
|
||||
assertThat(PB.toMB(1), equalTo(1024l * 1024 * 1024));
|
||||
assertThat(PB.toGB(1), equalTo(1024l * 1024));
|
||||
assertThat(PB.toTB(1), equalTo(1024l));
|
||||
assertThat(PB.toPB(1), equalTo(1l));
|
||||
assertThat(PB.toBytes(1), equalTo(1024L * 1024 * 1024 * 1024 * 1024));
|
||||
assertThat(PB.toKB(1), equalTo(1024L * 1024 * 1024 * 1024));
|
||||
assertThat(PB.toMB(1), equalTo(1024L * 1024 * 1024));
|
||||
assertThat(PB.toGB(1), equalTo(1024L * 1024));
|
||||
assertThat(PB.toTB(1), equalTo(1024L));
|
||||
assertThat(PB.toPB(1), equalTo(1L));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,15 +32,15 @@ import static org.hamcrest.Matchers.is;
|
|||
*/
|
||||
public class ByteSizeValueTests extends ESTestCase {
|
||||
public void testActualPeta() {
|
||||
MatcherAssert.assertThat(new ByteSizeValue(4, ByteSizeUnit.PB).bytes(), equalTo(4503599627370496l));
|
||||
MatcherAssert.assertThat(new ByteSizeValue(4, ByteSizeUnit.PB).bytes(), equalTo(4503599627370496L));
|
||||
}
|
||||
|
||||
public void testActualTera() {
|
||||
MatcherAssert.assertThat(new ByteSizeValue(4, ByteSizeUnit.TB).bytes(), equalTo(4398046511104l));
|
||||
MatcherAssert.assertThat(new ByteSizeValue(4, ByteSizeUnit.TB).bytes(), equalTo(4398046511104L));
|
||||
}
|
||||
|
||||
public void testActual() {
|
||||
MatcherAssert.assertThat(new ByteSizeValue(4, ByteSizeUnit.GB).bytes(), equalTo(4294967296l));
|
||||
MatcherAssert.assertThat(new ByteSizeValue(4, ByteSizeUnit.GB).bytes(), equalTo(4294967296L));
|
||||
}
|
||||
|
||||
public void testSimple() {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class FuzzinessTests extends ESTestCase {
|
|||
assertThat(Fuzziness.build(randomFrom(options)).asInt(), equalTo(1));
|
||||
assertThat(Fuzziness.build(randomFrom(options)).asFloat(), equalTo(1f));
|
||||
assertThat(Fuzziness.build(randomFrom(options)).asDouble(), equalTo(1d));
|
||||
assertThat(Fuzziness.build(randomFrom(options)).asLong(), equalTo(1l));
|
||||
assertThat(Fuzziness.build(randomFrom(options)).asLong(), equalTo(1L));
|
||||
assertThat(Fuzziness.build(randomFrom(options)).asShort(), equalTo((short) 1));
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class FuzzinessTests extends ESTestCase {
|
|||
assertThat(Fuzziness.AUTO.asInt(), equalTo(1));
|
||||
assertThat(Fuzziness.AUTO.asFloat(), equalTo(1f));
|
||||
assertThat(Fuzziness.AUTO.asDouble(), equalTo(1d));
|
||||
assertThat(Fuzziness.AUTO.asLong(), equalTo(1l));
|
||||
assertThat(Fuzziness.AUTO.asLong(), equalTo(1L));
|
||||
assertThat(Fuzziness.AUTO.asShort(), equalTo((short) 1));
|
||||
assertThat(Fuzziness.AUTO.asTimeValue(), equalTo(TimeValue.parseTimeValue("1ms", TimeValue.timeValueMillis(1), "fuzziness")));
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import static org.hamcrest.Matchers.is;
|
|||
public class SizeValueTests extends ESTestCase {
|
||||
public void testThatConversionWorks() {
|
||||
SizeValue sizeValue = new SizeValue(1000);
|
||||
assertThat(sizeValue.kilo(), is(1l));
|
||||
assertThat(sizeValue.kilo(), is(1L));
|
||||
assertThat(sizeValue.toString(), is("1k"));
|
||||
|
||||
sizeValue = new SizeValue(1000, SizeUnit.KILO);
|
||||
|
|
|
@ -60,7 +60,7 @@ public class TimeValueTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testMinusOne() {
|
||||
assertThat(new TimeValue(-1).nanos(), lessThan(0l));
|
||||
assertThat(new TimeValue(-1).nanos(), lessThan(0L));
|
||||
}
|
||||
|
||||
public void testParseTimeValue() {
|
||||
|
|
|
@ -315,8 +315,8 @@ public class ObjectParserTests extends ESTestCase {
|
|||
assertArrayEquals(parse.double_array_field.toArray(), Arrays.asList(2.1d).toArray());
|
||||
assertEquals(parse.double_field, 2.1d, 0.0d);
|
||||
|
||||
assertArrayEquals(parse.long_array_field.toArray(), Arrays.asList(4l).toArray());
|
||||
assertEquals(parse.long_field, 4l);
|
||||
assertArrayEquals(parse.long_array_field.toArray(), Arrays.asList(4L).toArray());
|
||||
assertEquals(parse.long_field, 4L);
|
||||
|
||||
assertArrayEquals(parse.string_array_field.toArray(), Arrays.asList("5").toArray());
|
||||
assertEquals(parse.string_field, "5");
|
||||
|
|
|
@ -63,7 +63,7 @@ public class SimpleJodaTests extends ESTestCase {
|
|||
DateTimeFormatter formatter = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC);
|
||||
long millis = formatter.parseMillis("1970-01-01T00:00:00Z");
|
||||
|
||||
assertThat(millis, equalTo(0l));
|
||||
assertThat(millis, equalTo(0L));
|
||||
}
|
||||
|
||||
public void testUpperBound() {
|
||||
|
@ -79,20 +79,20 @@ public class SimpleJodaTests extends ESTestCase {
|
|||
public void testIsoDateFormatDateOptionalTimeUTC() {
|
||||
DateTimeFormatter formatter = ISODateTimeFormat.dateOptionalTimeParser().withZone(DateTimeZone.UTC);
|
||||
long millis = formatter.parseMillis("1970-01-01T00:00:00Z");
|
||||
assertThat(millis, equalTo(0l));
|
||||
assertThat(millis, equalTo(0L));
|
||||
millis = formatter.parseMillis("1970-01-01T00:00:00.001Z");
|
||||
assertThat(millis, equalTo(1l));
|
||||
assertThat(millis, equalTo(1L));
|
||||
millis = formatter.parseMillis("1970-01-01T00:00:00.1Z");
|
||||
assertThat(millis, equalTo(100l));
|
||||
assertThat(millis, equalTo(100L));
|
||||
millis = formatter.parseMillis("1970-01-01T00:00:00.1");
|
||||
assertThat(millis, equalTo(100l));
|
||||
assertThat(millis, equalTo(100L));
|
||||
millis = formatter.parseMillis("1970-01-01T00:00:00");
|
||||
assertThat(millis, equalTo(0l));
|
||||
assertThat(millis, equalTo(0L));
|
||||
millis = formatter.parseMillis("1970-01-01");
|
||||
assertThat(millis, equalTo(0l));
|
||||
assertThat(millis, equalTo(0L));
|
||||
|
||||
millis = formatter.parseMillis("1970");
|
||||
assertThat(millis, equalTo(0l));
|
||||
assertThat(millis, equalTo(0L));
|
||||
|
||||
try {
|
||||
formatter.parseMillis("1970 kuku");
|
||||
|
@ -109,15 +109,15 @@ public class SimpleJodaTests extends ESTestCase {
|
|||
public void testIsoVsCustom() {
|
||||
DateTimeFormatter formatter = ISODateTimeFormat.dateOptionalTimeParser().withZone(DateTimeZone.UTC);
|
||||
long millis = formatter.parseMillis("1970-01-01T00:00:00");
|
||||
assertThat(millis, equalTo(0l));
|
||||
assertThat(millis, equalTo(0L));
|
||||
|
||||
formatter = DateTimeFormat.forPattern("yyyy/MM/dd HH:mm:ss").withZone(DateTimeZone.UTC);
|
||||
millis = formatter.parseMillis("1970/01/01 00:00:00");
|
||||
assertThat(millis, equalTo(0l));
|
||||
assertThat(millis, equalTo(0L));
|
||||
|
||||
FormatDateTimeFormatter formatter2 = Joda.forPattern("yyyy/MM/dd HH:mm:ss");
|
||||
millis = formatter2.parser().parseMillis("1970/01/01 00:00:00");
|
||||
assertThat(millis, equalTo(0l));
|
||||
assertThat(millis, equalTo(0L));
|
||||
}
|
||||
|
||||
public void testWriteAndParse() {
|
||||
|
@ -345,19 +345,19 @@ public class SimpleJodaTests extends ESTestCase {
|
|||
public void testThatEpochParserIsIdempotent() {
|
||||
FormatDateTimeFormatter formatter = Joda.forPattern("epoch_millis");
|
||||
DateTime dateTime = formatter.parser().parseDateTime("1234567890123");
|
||||
assertThat(dateTime.getMillis(), is(1234567890123l));
|
||||
assertThat(dateTime.getMillis(), is(1234567890123L));
|
||||
dateTime = formatter.printer().parseDateTime("1234567890456");
|
||||
assertThat(dateTime.getMillis(), is(1234567890456l));
|
||||
assertThat(dateTime.getMillis(), is(1234567890456L));
|
||||
dateTime = formatter.parser().parseDateTime("1234567890789");
|
||||
assertThat(dateTime.getMillis(), is(1234567890789l));
|
||||
assertThat(dateTime.getMillis(), is(1234567890789L));
|
||||
|
||||
FormatDateTimeFormatter secondsFormatter = Joda.forPattern("epoch_second");
|
||||
DateTime secondsDateTime = secondsFormatter.parser().parseDateTime("1234567890");
|
||||
assertThat(secondsDateTime.getMillis(), is(1234567890000l));
|
||||
assertThat(secondsDateTime.getMillis(), is(1234567890000L));
|
||||
secondsDateTime = secondsFormatter.printer().parseDateTime("1234567890");
|
||||
assertThat(secondsDateTime.getMillis(), is(1234567890000l));
|
||||
assertThat(secondsDateTime.getMillis(), is(1234567890000L));
|
||||
secondsDateTime = secondsFormatter.parser().parseDateTime("1234567890");
|
||||
assertThat(secondsDateTime.getMillis(), is(1234567890000l));
|
||||
assertThat(secondsDateTime.getMillis(), is(1234567890000L));
|
||||
}
|
||||
|
||||
public void testThatDefaultFormatterChecksForCorrectYearLength() throws Exception {
|
||||
|
|
|
@ -469,7 +469,7 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase {
|
|||
int shard = MathUtils.mod(Murmur3HashFunction.hash(id), numPrimaries);
|
||||
logger.trace("[{}] indexing id [{}] through node [{}] targeting shard [{}]", name, id, node, shard);
|
||||
IndexResponse response = client.prepareIndex("test", "type", id).setSource("{}").setTimeout("1s").get();
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
ackedDocs.put(id, node);
|
||||
logger.trace("[{}] indexed id [{}] through node [{}]", name, id, node);
|
||||
} catch (ElasticsearchException e) {
|
||||
|
@ -728,14 +728,14 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase {
|
|||
|
||||
|
||||
IndexResponse indexResponse = internalCluster().client(notIsolatedNode).prepareIndex("test", "type").setSource("field", "value").get();
|
||||
assertThat(indexResponse.getVersion(), equalTo(1l));
|
||||
assertThat(indexResponse.getVersion(), equalTo(1L));
|
||||
|
||||
logger.info("Verifying if document exists via node[" + notIsolatedNode + "]");
|
||||
GetResponse getResponse = internalCluster().client(notIsolatedNode).prepareGet("test", "type", indexResponse.getId())
|
||||
.setPreference("_local")
|
||||
.get();
|
||||
assertThat(getResponse.isExists(), is(true));
|
||||
assertThat(getResponse.getVersion(), equalTo(1l));
|
||||
assertThat(getResponse.getVersion(), equalTo(1L));
|
||||
assertThat(getResponse.getId(), equalTo(indexResponse.getId()));
|
||||
|
||||
scheme.stopDisrupting();
|
||||
|
@ -749,7 +749,7 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase {
|
|||
.setPreference("_local")
|
||||
.get();
|
||||
assertThat(getResponse.isExists(), is(true));
|
||||
assertThat(getResponse.getVersion(), equalTo(1l));
|
||||
assertThat(getResponse.getVersion(), equalTo(1L));
|
||||
assertThat(getResponse.getId(), equalTo(indexResponse.getId()));
|
||||
}
|
||||
}
|
||||
|
@ -1049,7 +1049,7 @@ public class DiscoveryWithServiceDisruptionsIT extends ESIntegTestCase {
|
|||
// wait for relocation to finish
|
||||
endRelocationLatch.await();
|
||||
// now search for the documents and see if we get a reply
|
||||
assertThat(client().prepareSearch().setSize(0).get().getHits().totalHits(), equalTo(100l));
|
||||
assertThat(client().prepareSearch().setSize(0).get().getHits().totalHits(), equalTo(100L));
|
||||
}
|
||||
|
||||
public void testIndexImportedFromDataOnlyNodesIfMasterLostDataFolder() throws Exception {
|
||||
|
|
|
@ -157,14 +157,14 @@ public class DocumentActionsIT extends ESIntegTestCase {
|
|||
// test successful
|
||||
SearchResponse countResponse = client().prepareSearch("test").setSize(0).setQuery(termQuery("_type", "type1")).execute().actionGet();
|
||||
assertNoFailures(countResponse);
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(2L));
|
||||
assertThat(countResponse.getSuccessfulShards(), equalTo(numShards.numPrimaries));
|
||||
assertThat(countResponse.getFailedShards(), equalTo(0));
|
||||
|
||||
// count with no query is a match all one
|
||||
countResponse = client().prepareSearch("test").setSize(0).execute().actionGet();
|
||||
assertThat("Failures " + countResponse.getShardFailures(), countResponse.getShardFailures() == null ? 0 : countResponse.getShardFailures().length, equalTo(0));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(2l));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(2L));
|
||||
assertThat(countResponse.getSuccessfulShards(), equalTo(numShards.numPrimaries));
|
||||
assertThat(countResponse.getFailedShards(), equalTo(0));
|
||||
}
|
||||
|
|
|
@ -144,32 +144,32 @@ public class FieldStatsIntegrationIT extends ESIntegTestCase {
|
|||
// default:
|
||||
FieldStatsResponse response = client().prepareFieldStats().setFields("value").get();
|
||||
assertAllSuccessful(response);
|
||||
assertThat(response.getAllFieldStats().get("value").getMinValue(), equalTo(-10l));
|
||||
assertThat(response.getAllFieldStats().get("value").getMaxValue(), equalTo(300l));
|
||||
assertThat(response.getAllFieldStats().get("value").getMinValue(), equalTo(-10L));
|
||||
assertThat(response.getAllFieldStats().get("value").getMaxValue(), equalTo(300L));
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(1));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("_all").get("value").getMinValue(), equalTo(-10l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("_all").get("value").getMaxValue(), equalTo(300l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("_all").get("value").getMinValue(), equalTo(-10L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("_all").get("value").getMaxValue(), equalTo(300L));
|
||||
|
||||
// Level: cluster
|
||||
response = client().prepareFieldStats().setFields("value").setLevel("cluster").get();
|
||||
assertAllSuccessful(response);
|
||||
assertThat(response.getAllFieldStats().get("value").getMinValue(), equalTo(-10l));
|
||||
assertThat(response.getAllFieldStats().get("value").getMaxValue(), equalTo(300l));
|
||||
assertThat(response.getAllFieldStats().get("value").getMinValue(), equalTo(-10L));
|
||||
assertThat(response.getAllFieldStats().get("value").getMaxValue(), equalTo(300L));
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(1));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("_all").get("value").getMinValue(), equalTo(-10l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("_all").get("value").getMaxValue(), equalTo(300l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("_all").get("value").getMinValue(), equalTo(-10L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("_all").get("value").getMaxValue(), equalTo(300L));
|
||||
|
||||
// Level: indices
|
||||
response = client().prepareFieldStats().setFields("value").setLevel("indices").get();
|
||||
assertAllSuccessful(response);
|
||||
assertThat(response.getAllFieldStats(), nullValue());
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(3));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(-10l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMaxValue(), equalTo(100l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(101l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMaxValue(), equalTo(200l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMinValue(), equalTo(201l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMaxValue(), equalTo(300l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(-10L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMaxValue(), equalTo(100L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(101L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMaxValue(), equalTo(200L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMinValue(), equalTo(201L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMaxValue(), equalTo(300L));
|
||||
|
||||
// Illegal level option:
|
||||
try {
|
||||
|
@ -189,8 +189,8 @@ public class FieldStatsIntegrationIT extends ESIntegTestCase {
|
|||
));
|
||||
ensureGreen("test1", "test2");
|
||||
|
||||
client().prepareIndex("test1", "test").setSource("value", 1l).get();
|
||||
client().prepareIndex("test1", "test").setSource("value", 2l).get();
|
||||
client().prepareIndex("test1", "test").setSource("value", 1L).get();
|
||||
client().prepareIndex("test1", "test").setSource("value", 2L).get();
|
||||
client().prepareIndex("test2", "test").setSource("value", "a").get();
|
||||
client().prepareIndex("test2", "test").setSource("value", "b").get();
|
||||
refresh();
|
||||
|
@ -205,8 +205,8 @@ public class FieldStatsIntegrationIT extends ESIntegTestCase {
|
|||
FieldStatsResponse response = client().prepareFieldStats().setFields("value").setLevel("indices").get();
|
||||
assertAllSuccessful(response);
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(2));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMaxValue(), equalTo(2l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMaxValue(), equalTo(2L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(new BytesRef("a")));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMaxValue(), equalTo(new BytesRef("b")));
|
||||
}
|
||||
|
@ -235,8 +235,8 @@ public class FieldStatsIntegrationIT extends ESIntegTestCase {
|
|||
assertAllSuccessful(response);
|
||||
assertThat(response.getAllFieldStats(), nullValue());
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(1));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMinValue(), equalTo(201l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMaxValue(), equalTo(300l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMinValue(), equalTo(201L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMaxValue(), equalTo(300L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
@ -246,10 +246,10 @@ public class FieldStatsIntegrationIT extends ESIntegTestCase {
|
|||
assertAllSuccessful(response);
|
||||
assertThat(response.getAllFieldStats(), nullValue());
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(2));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(-10l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMaxValue(), equalTo(100l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(101l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMaxValue(), equalTo(200l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(-10L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMaxValue(), equalTo(100L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(101L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMaxValue(), equalTo(200L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
@ -259,10 +259,10 @@ public class FieldStatsIntegrationIT extends ESIntegTestCase {
|
|||
assertAllSuccessful(response);
|
||||
assertThat(response.getAllFieldStats(), nullValue());
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(2));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(101l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMaxValue(), equalTo(200l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMinValue(), equalTo(201l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMaxValue(), equalTo(300l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(101L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMaxValue(), equalTo(200L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMinValue(), equalTo(201L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMaxValue(), equalTo(300L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
@ -290,8 +290,8 @@ public class FieldStatsIntegrationIT extends ESIntegTestCase {
|
|||
assertAllSuccessful(response);
|
||||
assertThat(response.getAllFieldStats(), nullValue());
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(1));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(101l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMaxValue(), equalTo(200l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(101L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMaxValue(), equalTo(200L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
@ -301,8 +301,8 @@ public class FieldStatsIntegrationIT extends ESIntegTestCase {
|
|||
assertAllSuccessful(response);
|
||||
assertThat(response.getAllFieldStats(), nullValue());
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(1));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMinValue(), equalTo(201l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMaxValue(), equalTo(300l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMinValue(), equalTo(201L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test3").get("value").getMaxValue(), equalTo(300L));
|
||||
}
|
||||
|
||||
public void testIncompatibleFilter() throws Exception {
|
||||
|
|
|
@ -66,9 +66,9 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
}
|
||||
|
||||
public void testLong() {
|
||||
testNumberRange("field1", "long", 312321312312412l, 312321312312422l);
|
||||
testNumberRange("field1", "long", 312321312312412L, 312321312312422L);
|
||||
testNumberRange("field1", "long", -5, 5);
|
||||
testNumberRange("field1", "long", -312321312312422l, -312321312312412l);
|
||||
testNumberRange("field1", "long", -312321312312422L, -312321312312412L);
|
||||
}
|
||||
|
||||
public void testString() {
|
||||
|
@ -79,8 +79,8 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
client().admin().indices().prepareRefresh().get();
|
||||
|
||||
FieldStatsResponse result = client().prepareFieldStats().setFields("field").get();
|
||||
assertThat(result.getAllFieldStats().get("field").getMaxDoc(), equalTo(11l));
|
||||
assertThat(result.getAllFieldStats().get("field").getDocCount(), equalTo(11l));
|
||||
assertThat(result.getAllFieldStats().get("field").getMaxDoc(), equalTo(11L));
|
||||
assertThat(result.getAllFieldStats().get("field").getDocCount(), equalTo(11L));
|
||||
assertThat(result.getAllFieldStats().get("field").getDensity(), equalTo(100));
|
||||
assertThat(result.getAllFieldStats().get("field").getMinValue(), equalTo(new BytesRef(String.format(Locale.ENGLISH, "%03d", 0))));
|
||||
assertThat(result.getAllFieldStats().get("field").getMaxValue(), equalTo(new BytesRef(String.format(Locale.ENGLISH, "%03d", 10))));
|
||||
|
@ -97,8 +97,8 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
client().admin().indices().prepareRefresh().get();
|
||||
|
||||
FieldStatsResponse result = client().prepareFieldStats().setFields(fieldName).get();
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getMaxDoc(), equalTo(11l));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getDocCount(), equalTo(11l));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getMaxDoc(), equalTo(11L));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getDocCount(), equalTo(11L));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getDensity(), equalTo(100));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getMinValue(), equalTo(-1d));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getMaxValue(), equalTo(9d));
|
||||
|
@ -114,8 +114,8 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
client().admin().indices().prepareRefresh().get();
|
||||
|
||||
FieldStatsResponse result = client().prepareFieldStats().setFields(fieldName).get();
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getMaxDoc(), equalTo(11l));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getDocCount(), equalTo(11l));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getMaxDoc(), equalTo(11L));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getDocCount(), equalTo(11L));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getDensity(), equalTo(100));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getMinValue(), equalTo(-1f));
|
||||
assertThat(result.getAllFieldStats().get(fieldName).getMaxValue(), equalTo(9f));
|
||||
|
@ -144,44 +144,44 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
|
||||
public void testMerge() {
|
||||
List<FieldStats> stats = new ArrayList<>();
|
||||
stats.add(new FieldStats.Long(1, 1l, 1l, 1l, 1l, 1l));
|
||||
stats.add(new FieldStats.Long(1, 1l, 1l, 1l, 1l, 1l));
|
||||
stats.add(new FieldStats.Long(1, 1l, 1l, 1l, 1l, 1l));
|
||||
stats.add(new FieldStats.Long(1, 1L, 1L, 1L, 1L, 1L));
|
||||
stats.add(new FieldStats.Long(1, 1L, 1L, 1L, 1L, 1L));
|
||||
stats.add(new FieldStats.Long(1, 1L, 1L, 1L, 1L, 1L));
|
||||
|
||||
FieldStats stat = new FieldStats.Long(1, 1l, 1l, 1l, 1l, 1l);
|
||||
FieldStats stat = new FieldStats.Long(1, 1L, 1L, 1L, 1L, 1L);
|
||||
for (FieldStats otherStat : stats) {
|
||||
stat.append(otherStat);
|
||||
}
|
||||
assertThat(stat.getMaxDoc(), equalTo(4l));
|
||||
assertThat(stat.getDocCount(), equalTo(4l));
|
||||
assertThat(stat.getSumDocFreq(), equalTo(4l));
|
||||
assertThat(stat.getSumTotalTermFreq(), equalTo(4l));
|
||||
assertThat(stat.getMaxDoc(), equalTo(4L));
|
||||
assertThat(stat.getDocCount(), equalTo(4L));
|
||||
assertThat(stat.getSumDocFreq(), equalTo(4L));
|
||||
assertThat(stat.getSumTotalTermFreq(), equalTo(4L));
|
||||
}
|
||||
|
||||
public void testMerge_notAvailable() {
|
||||
List<FieldStats> stats = new ArrayList<>();
|
||||
stats.add(new FieldStats.Long(1, 1l, 1l, 1l, 1l, 1l));
|
||||
stats.add(new FieldStats.Long(1, 1l, 1l, 1l, 1l, 1l));
|
||||
stats.add(new FieldStats.Long(1, 1l, 1l, 1l, 1l, 1l));
|
||||
stats.add(new FieldStats.Long(1, 1L, 1L, 1L, 1L, 1L));
|
||||
stats.add(new FieldStats.Long(1, 1L, 1L, 1L, 1L, 1L));
|
||||
stats.add(new FieldStats.Long(1, 1L, 1L, 1L, 1L, 1L));
|
||||
|
||||
FieldStats stat = new FieldStats.Long(1, -1l, -1l, -1l, 1l, 1l);
|
||||
FieldStats stat = new FieldStats.Long(1, -1L, -1L, -1L, 1L, 1L);
|
||||
for (FieldStats otherStat : stats) {
|
||||
stat.append(otherStat);
|
||||
}
|
||||
assertThat(stat.getMaxDoc(), equalTo(4l));
|
||||
assertThat(stat.getDocCount(), equalTo(-1l));
|
||||
assertThat(stat.getSumDocFreq(), equalTo(-1l));
|
||||
assertThat(stat.getSumTotalTermFreq(), equalTo(-1l));
|
||||
assertThat(stat.getMaxDoc(), equalTo(4L));
|
||||
assertThat(stat.getDocCount(), equalTo(-1L));
|
||||
assertThat(stat.getSumDocFreq(), equalTo(-1L));
|
||||
assertThat(stat.getSumTotalTermFreq(), equalTo(-1L));
|
||||
|
||||
stats.add(new FieldStats.Long(1, -1l, -1l, -1l, 1l, 1l));
|
||||
stats.add(new FieldStats.Long(1, -1L, -1L, -1L, 1L, 1L));
|
||||
stat = stats.remove(0);
|
||||
for (FieldStats otherStat : stats) {
|
||||
stat.append(otherStat);
|
||||
}
|
||||
assertThat(stat.getMaxDoc(), equalTo(4l));
|
||||
assertThat(stat.getDocCount(), equalTo(-1l));
|
||||
assertThat(stat.getSumDocFreq(), equalTo(-1l));
|
||||
assertThat(stat.getSumTotalTermFreq(), equalTo(-1l));
|
||||
assertThat(stat.getMaxDoc(), equalTo(4L));
|
||||
assertThat(stat.getDocCount(), equalTo(-1L));
|
||||
assertThat(stat.getSumDocFreq(), equalTo(-1L));
|
||||
assertThat(stat.getSumTotalTermFreq(), equalTo(-1L));
|
||||
}
|
||||
|
||||
public void testInvalidField() {
|
||||
|
@ -213,9 +213,9 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
|
||||
public void testNumberFiltering() {
|
||||
createIndex("test1", Settings.EMPTY, "type", "value", "type=long");
|
||||
client().prepareIndex("test1", "test").setSource("value", 1l).get();
|
||||
client().prepareIndex("test1", "test").setSource("value", 1L).get();
|
||||
createIndex("test2", Settings.EMPTY, "type", "value", "type=long");
|
||||
client().prepareIndex("test2", "test").setSource("value", 3l).get();
|
||||
client().prepareIndex("test2", "test").setSource("value", 3L).get();
|
||||
client().admin().indices().prepareRefresh().get();
|
||||
|
||||
FieldStatsResponse response = client().prepareFieldStats()
|
||||
|
@ -223,8 +223,8 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
.setLevel("indices")
|
||||
.get();
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(2));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(3l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(3L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
@ -246,7 +246,7 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
.setLevel("indices")
|
||||
.get();
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(1));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
@ -254,7 +254,7 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
.setLevel("indices")
|
||||
.get();
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(1));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
@ -269,7 +269,7 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
.setLevel("indices")
|
||||
.get();
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(1));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(3l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(3L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
@ -277,7 +277,7 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
.setLevel("indices")
|
||||
.get();
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(1));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(3l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(3L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
@ -292,8 +292,8 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
|
|||
.setLevel("indices")
|
||||
.get();
|
||||
assertThat(response.getIndicesMergedFieldStats().size(), equalTo(2));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(3l));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test1").get("value").getMinValue(), equalTo(1L));
|
||||
assertThat(response.getIndicesMergedFieldStats().get("test2").get("value").getMinValue(), equalTo(3L));
|
||||
|
||||
response = client().prepareFieldStats()
|
||||
.setFields("value")
|
||||
|
|
|
@ -232,7 +232,7 @@ public class GatewayIndexStateIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> verify 1 doc in the index");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1l);
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1L);
|
||||
}
|
||||
|
||||
logger.info("--> closing test index...");
|
||||
|
@ -250,9 +250,9 @@ public class GatewayIndexStateIT extends ESIntegTestCase {
|
|||
assertThat(health.isTimedOut(), equalTo(false));
|
||||
|
||||
logger.info("--> verify 1 doc in the index");
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1l);
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1L);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1l);
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1L);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ public class GatewayIndexStateIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> verify 1 doc in the index");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1l);
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1L);
|
||||
}
|
||||
assertThat(client().prepareGet("test", "type1", "1").execute().actionGet().isExists(), equalTo(true));
|
||||
|
||||
|
@ -328,7 +328,7 @@ public class GatewayIndexStateIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> verify 1 doc in the index");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1l);
|
||||
assertHitCount(client().prepareSearch().setQuery(matchAllQuery()).get(), 1L);
|
||||
}
|
||||
assertThat(client().prepareGet("test", "type1", "1").execute().actionGet().isExists(), equalTo(true));
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ public class MetaDataStateFormatTests extends ESTestCase {
|
|||
long checksumAfterCorruption;
|
||||
long actualChecksumAfterCorruption;
|
||||
try (ChecksumIndexInput input = dir.openChecksumInput(fileToCorrupt.getFileName().toString(), IOContext.DEFAULT)) {
|
||||
assertThat(input.getFilePointer(), is(0l));
|
||||
assertThat(input.getFilePointer(), is(0L));
|
||||
input.seek(input.length() - 8); // one long is the checksum... 8 bytes
|
||||
checksumAfterCorruption = input.getChecksum();
|
||||
actualChecksumAfterCorruption = input.readLong();
|
||||
|
|
|
@ -67,7 +67,7 @@ public class QuorumGatewayIT extends ESIntegTestCase {
|
|||
refresh();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2l);
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2L);
|
||||
}
|
||||
logger.info("--> restart all nodes");
|
||||
internalCluster().fullRestart(new RestartCallback() {
|
||||
|
@ -89,7 +89,7 @@ public class QuorumGatewayIT extends ESIntegTestCase {
|
|||
activeClient.prepareIndex("test", "type1", "3").setSource(jsonBuilder().startObject().field("field", "value3").endObject()).get();
|
||||
assertNoFailures(activeClient.admin().indices().prepareRefresh().get());
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(activeClient.prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 3l);
|
||||
assertHitCount(activeClient.prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 3L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class QuorumGatewayIT extends ESIntegTestCase {
|
|||
ensureGreen();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 3l);
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 3L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,8 +98,8 @@ public class RecoveryBackwardsCompatibilityIT extends ESBackcompatTestCase {
|
|||
final String recoverStateAsJSON = XContentHelper.toString(recoveryState, params);
|
||||
if (!recoveryState.getPrimary()) {
|
||||
RecoveryState.Index index = recoveryState.getIndex();
|
||||
assertThat(recoverStateAsJSON, index.recoveredBytes(), equalTo(0l));
|
||||
assertThat(recoverStateAsJSON, index.reusedBytes(), greaterThan(0l));
|
||||
assertThat(recoverStateAsJSON, index.recoveredBytes(), equalTo(0L));
|
||||
assertThat(recoverStateAsJSON, index.reusedBytes(), greaterThan(0L));
|
||||
assertThat(recoverStateAsJSON, index.reusedBytes(), equalTo(index.totalBytes()));
|
||||
assertThat(recoverStateAsJSON, index.recoveredFileCount(), equalTo(0));
|
||||
assertThat(recoverStateAsJSON, index.reusedFileCount(), equalTo(index.totalFileCount()));
|
||||
|
|
|
@ -409,7 +409,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase {
|
|||
recoveryState.getShardId().getId(), recoveryState.getSourceNode().name(), recoveryState.getTargetNode().name(),
|
||||
recoveryState.getIndex().recoveredBytes(), recoveryState.getIndex().reusedBytes());
|
||||
assertThat("no bytes should be recovered", recoveryState.getIndex().recoveredBytes(), equalTo(recovered));
|
||||
assertThat("data should have been reused", recoveryState.getIndex().reusedBytes(), greaterThan(0l));
|
||||
assertThat("data should have been reused", recoveryState.getIndex().reusedBytes(), greaterThan(0L));
|
||||
// we have to recover the segments file since we commit the translog ID on engine startup
|
||||
assertThat("all bytes should be reused except of the segments file", recoveryState.getIndex().reusedBytes(), equalTo(recoveryState.getIndex().totalBytes() - recovered));
|
||||
assertThat("no files should be recovered except of the segments file", recoveryState.getIndex().recoveredFileCount(), equalTo(1));
|
||||
|
@ -421,7 +421,7 @@ public class RecoveryFromGatewayIT extends ESIntegTestCase {
|
|||
recoveryState.getShardId().getId(), recoveryState.getSourceNode().name(), recoveryState.getTargetNode().name(),
|
||||
recoveryState.getIndex().recoveredBytes(), recoveryState.getIndex().reusedBytes());
|
||||
}
|
||||
assertThat(recoveryState.getIndex().recoveredBytes(), equalTo(0l));
|
||||
assertThat(recoveryState.getIndex().recoveredBytes(), equalTo(0L));
|
||||
assertThat(recoveryState.getIndex().reusedBytes(), equalTo(recoveryState.getIndex().totalBytes()));
|
||||
assertThat(recoveryState.getIndex().recoveredFileCount(), equalTo(0));
|
||||
assertThat(recoveryState.getIndex().reusedFileCount(), equalTo(recoveryState.getIndex().totalFileCount()));
|
||||
|
|
|
@ -127,7 +127,7 @@ public class ReusePeerRecoverySharedTest {
|
|||
recoveryState.getSourceNode().name(), recoveryState.getTargetNode().name(),
|
||||
recoveryState.getIndex().recoveredBytes(), recoveryState.getIndex().reusedBytes());
|
||||
assertThat("no bytes should be recovered", recoveryState.getIndex().recoveredBytes(), equalTo(recovered));
|
||||
assertThat("data should have been reused", recoveryState.getIndex().reusedBytes(), greaterThan(0l));
|
||||
assertThat("data should have been reused", recoveryState.getIndex().reusedBytes(), greaterThan(0L));
|
||||
// we have to recover the segments file since we commit the translog ID on engine startup
|
||||
assertThat("all bytes should be reused except of the segments file", recoveryState.getIndex().reusedBytes(),
|
||||
equalTo(recoveryState.getIndex().totalBytes() - recovered));
|
||||
|
@ -142,7 +142,7 @@ public class ReusePeerRecoverySharedTest {
|
|||
recoveryState.getShardId().getId(), recoveryState.getSourceNode().name(), recoveryState.getTargetNode().name(),
|
||||
recoveryState.getIndex().recoveredBytes(), recoveryState.getIndex().reusedBytes());
|
||||
}
|
||||
assertThat(recoveryState.getIndex().recoveredBytes(), equalTo(0l));
|
||||
assertThat(recoveryState.getIndex().recoveredBytes(), equalTo(0L));
|
||||
assertThat(recoveryState.getIndex().reusedBytes(), equalTo(recoveryState.getIndex().totalBytes()));
|
||||
assertThat(recoveryState.getIndex().recoveredFileCount(), equalTo(0));
|
||||
assertThat(recoveryState.getIndex().reusedFileCount(), equalTo(recoveryState.getIndex().totalFileCount()));
|
||||
|
|
|
@ -462,12 +462,12 @@ public class GetActionIT extends ESIntegTestCase {
|
|||
response = client().prepareGet(indexOrAlias(), "type1", "1").setVersion(Versions.MATCH_ANY).get();
|
||||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
|
||||
response = client().prepareGet(indexOrAlias(), "type1", "1").setVersion(1).get();
|
||||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
|
||||
try {
|
||||
client().prepareGet(indexOrAlias(), "type1", "1").setVersion(2).get();
|
||||
|
@ -483,13 +483,13 @@ public class GetActionIT extends ESIntegTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
|
||||
response = client().prepareGet(indexOrAlias(), "type1", "1").setVersion(1).setRealtime(false).get();
|
||||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
|
||||
try {
|
||||
client().prepareGet(indexOrAlias(), "type1", "1").setVersion(2).setRealtime(false).get();
|
||||
|
@ -507,7 +507,7 @@ public class GetActionIT extends ESIntegTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(2l));
|
||||
assertThat(response.getVersion(), equalTo(2L));
|
||||
|
||||
try {
|
||||
client().prepareGet(indexOrAlias(), "type1", "1").setVersion(1).get();
|
||||
|
@ -520,7 +520,7 @@ public class GetActionIT extends ESIntegTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(2l));
|
||||
assertThat(response.getVersion(), equalTo(2L));
|
||||
|
||||
// From Lucene index:
|
||||
refresh();
|
||||
|
@ -529,7 +529,7 @@ public class GetActionIT extends ESIntegTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(2l));
|
||||
assertThat(response.getVersion(), equalTo(2L));
|
||||
|
||||
try {
|
||||
client().prepareGet(indexOrAlias(), "type1", "1").setVersion(1).setRealtime(false).get();
|
||||
|
@ -542,7 +542,7 @@ public class GetActionIT extends ESIntegTestCase {
|
|||
assertThat(response.isExists(), equalTo(true));
|
||||
assertThat(response.getId(), equalTo("1"));
|
||||
assertThat(response.getIndex(), equalTo("test"));
|
||||
assertThat(response.getVersion(), equalTo(2l));
|
||||
assertThat(response.getVersion(), equalTo(2L));
|
||||
}
|
||||
|
||||
public void testMultiGetWithVersion() throws Exception {
|
||||
|
|
|
@ -192,24 +192,24 @@ public class VersionTypeTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testUpdateVersion() {
|
||||
assertThat(VersionType.INTERNAL.updateVersion(Versions.NOT_SET, 10), equalTo(1l));
|
||||
assertThat(VersionType.INTERNAL.updateVersion(Versions.NOT_FOUND, 10), equalTo(1l));
|
||||
assertThat(VersionType.INTERNAL.updateVersion(1, 1), equalTo(2l));
|
||||
assertThat(VersionType.INTERNAL.updateVersion(2, Versions.MATCH_ANY), equalTo(3l));
|
||||
assertThat(VersionType.INTERNAL.updateVersion(Versions.NOT_SET, 10), equalTo(1L));
|
||||
assertThat(VersionType.INTERNAL.updateVersion(Versions.NOT_FOUND, 10), equalTo(1L));
|
||||
assertThat(VersionType.INTERNAL.updateVersion(1, 1), equalTo(2L));
|
||||
assertThat(VersionType.INTERNAL.updateVersion(2, Versions.MATCH_ANY), equalTo(3L));
|
||||
|
||||
|
||||
assertThat(VersionType.EXTERNAL.updateVersion(Versions.NOT_SET, 10), equalTo(10l));
|
||||
assertThat(VersionType.EXTERNAL.updateVersion(Versions.NOT_FOUND, 10), equalTo(10l));
|
||||
assertThat(VersionType.EXTERNAL.updateVersion(1, 10), equalTo(10l));
|
||||
assertThat(VersionType.EXTERNAL.updateVersion(Versions.NOT_SET, 10), equalTo(10L));
|
||||
assertThat(VersionType.EXTERNAL.updateVersion(Versions.NOT_FOUND, 10), equalTo(10L));
|
||||
assertThat(VersionType.EXTERNAL.updateVersion(1, 10), equalTo(10L));
|
||||
|
||||
assertThat(VersionType.EXTERNAL_GTE.updateVersion(Versions.NOT_SET, 10), equalTo(10l));
|
||||
assertThat(VersionType.EXTERNAL_GTE.updateVersion(Versions.NOT_FOUND, 10), equalTo(10l));
|
||||
assertThat(VersionType.EXTERNAL_GTE.updateVersion(1, 10), equalTo(10l));
|
||||
assertThat(VersionType.EXTERNAL_GTE.updateVersion(10, 10), equalTo(10l));
|
||||
assertThat(VersionType.EXTERNAL_GTE.updateVersion(Versions.NOT_SET, 10), equalTo(10L));
|
||||
assertThat(VersionType.EXTERNAL_GTE.updateVersion(Versions.NOT_FOUND, 10), equalTo(10L));
|
||||
assertThat(VersionType.EXTERNAL_GTE.updateVersion(1, 10), equalTo(10L));
|
||||
assertThat(VersionType.EXTERNAL_GTE.updateVersion(10, 10), equalTo(10L));
|
||||
|
||||
assertThat(VersionType.FORCE.updateVersion(Versions.NOT_SET, 10), equalTo(10l));
|
||||
assertThat(VersionType.FORCE.updateVersion(Versions.NOT_FOUND, 10), equalTo(10l));
|
||||
assertThat(VersionType.FORCE.updateVersion(11, 10), equalTo(10l));
|
||||
assertThat(VersionType.FORCE.updateVersion(Versions.NOT_SET, 10), equalTo(10L));
|
||||
assertThat(VersionType.FORCE.updateVersion(Versions.NOT_FOUND, 10), equalTo(10L));
|
||||
assertThat(VersionType.FORCE.updateVersion(11, 10), equalTo(10L));
|
||||
|
||||
// Old indexing code
|
||||
// if (index.versionType() == VersionType.INTERNAL) { // internal version type
|
||||
|
|
|
@ -293,8 +293,8 @@ public class InternalEngineTests extends ESTestCase {
|
|||
Engine engine = createEngine(defaultSettings, store, createTempDir(), NoMergePolicy.INSTANCE)) {
|
||||
List<Segment> segments = engine.segments(false);
|
||||
assertThat(segments.isEmpty(), equalTo(true));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(0l));
|
||||
assertThat(engine.segmentsStats().getMemoryInBytes(), equalTo(0l));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(0L));
|
||||
assertThat(engine.segmentsStats().getMemoryInBytes(), equalTo(0L));
|
||||
|
||||
// create a doc and refresh
|
||||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocumentWithTextField(), B_1, null);
|
||||
|
@ -307,12 +307,12 @@ public class InternalEngineTests extends ESTestCase {
|
|||
segments = engine.segments(false);
|
||||
assertThat(segments.size(), equalTo(1));
|
||||
SegmentsStats stats = engine.segmentsStats();
|
||||
assertThat(stats.getCount(), equalTo(1l));
|
||||
assertThat(stats.getTermsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getStoredFieldsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTermVectorsMemoryInBytes(), equalTo(0l));
|
||||
assertThat(stats.getNormsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getDocValuesMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getCount(), equalTo(1L));
|
||||
assertThat(stats.getTermsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getStoredFieldsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTermVectorsMemoryInBytes(), equalTo(0L));
|
||||
assertThat(stats.getNormsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getDocValuesMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(segments.get(0).isCommitted(), equalTo(false));
|
||||
assertThat(segments.get(0).isSearch(), equalTo(true));
|
||||
assertThat(segments.get(0).getNumDocs(), equalTo(2));
|
||||
|
@ -324,7 +324,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
|
||||
segments = engine.segments(false);
|
||||
assertThat(segments.size(), equalTo(1));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(1l));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(1L));
|
||||
assertThat(segments.get(0).isCommitted(), equalTo(true));
|
||||
assertThat(segments.get(0).isSearch(), equalTo(true));
|
||||
assertThat(segments.get(0).getNumDocs(), equalTo(2));
|
||||
|
@ -337,10 +337,10 @@ public class InternalEngineTests extends ESTestCase {
|
|||
|
||||
segments = engine.segments(false);
|
||||
assertThat(segments.size(), equalTo(2));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(2l));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(2L));
|
||||
assertThat(engine.segmentsStats().getTermsMemoryInBytes(), greaterThan(stats.getTermsMemoryInBytes()));
|
||||
assertThat(engine.segmentsStats().getStoredFieldsMemoryInBytes(), greaterThan(stats.getStoredFieldsMemoryInBytes()));
|
||||
assertThat(engine.segmentsStats().getTermVectorsMemoryInBytes(), equalTo(0l));
|
||||
assertThat(engine.segmentsStats().getTermVectorsMemoryInBytes(), equalTo(0L));
|
||||
assertThat(engine.segmentsStats().getNormsMemoryInBytes(), greaterThan(stats.getNormsMemoryInBytes()));
|
||||
assertThat(engine.segmentsStats().getDocValuesMemoryInBytes(), greaterThan(stats.getDocValuesMemoryInBytes()));
|
||||
assertThat(segments.get(0).getGeneration() < segments.get(1).getGeneration(), equalTo(true));
|
||||
|
@ -363,7 +363,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
|
||||
segments = engine.segments(false);
|
||||
assertThat(segments.size(), equalTo(2));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(2l));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(2L));
|
||||
assertThat(segments.get(0).getGeneration() < segments.get(1).getGeneration(), equalTo(true));
|
||||
assertThat(segments.get(0).isCommitted(), equalTo(true));
|
||||
assertThat(segments.get(0).isSearch(), equalTo(true));
|
||||
|
@ -384,7 +384,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
|
||||
segments = engine.segments(false);
|
||||
assertThat(segments.size(), equalTo(3));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(3l));
|
||||
assertThat(engine.segmentsStats().getCount(), equalTo(3L));
|
||||
assertThat(segments.get(0).getGeneration() < segments.get(1).getGeneration(), equalTo(true));
|
||||
assertThat(segments.get(0).isCommitted(), equalTo(true));
|
||||
assertThat(segments.get(0).isSearch(), equalTo(true));
|
||||
|
@ -494,7 +494,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
engine.index(new Engine.Index(newUid("1"), doc));
|
||||
|
||||
CommitStats stats1 = engine.commitStats();
|
||||
assertThat(stats1.getGeneration(), greaterThan(0l));
|
||||
assertThat(stats1.getGeneration(), greaterThan(0L));
|
||||
assertThat(stats1.getId(), notNullValue());
|
||||
assertThat(stats1.getUserData(), hasKey(Translog.TRANSLOG_GENERATION_KEY));
|
||||
|
||||
|
@ -895,46 +895,46 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index create = new Engine.Index(newUid("1"), doc, Versions.MATCH_DELETED);
|
||||
engine.index(create);
|
||||
assertThat(create.version(), equalTo(1l));
|
||||
assertThat(create.version(), equalTo(1L));
|
||||
|
||||
create = new Engine.Index(newUid("1"), doc, create.version(), create.versionType().versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
replicaEngine.index(create);
|
||||
assertThat(create.version(), equalTo(1l));
|
||||
assertThat(create.version(), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testVersioningNewIndex() {
|
||||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(1l));
|
||||
assertThat(index.version(), equalTo(1L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc, index.version(), index.versionType().versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
replicaEngine.index(index);
|
||||
assertThat(index.version(), equalTo(1l));
|
||||
assertThat(index.version(), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testExternalVersioningNewIndex() {
|
||||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc, 12, VersionType.EXTERNAL, PRIMARY, 0);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(12l));
|
||||
assertThat(index.version(), equalTo(12L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc, index.version(), index.versionType().versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
replicaEngine.index(index);
|
||||
assertThat(index.version(), equalTo(12l));
|
||||
assertThat(index.version(), equalTo(12L));
|
||||
}
|
||||
|
||||
public void testVersioningIndexConflict() {
|
||||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(1l));
|
||||
assertThat(index.version(), equalTo(1L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(2l));
|
||||
assertThat(index.version(), equalTo(2L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc, 1l, VersionType.INTERNAL, Engine.Operation.Origin.PRIMARY, 0);
|
||||
index = new Engine.Index(newUid("1"), doc, 1L, VersionType.INTERNAL, Engine.Operation.Origin.PRIMARY, 0);
|
||||
try {
|
||||
engine.index(index);
|
||||
fail();
|
||||
|
@ -943,7 +943,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
}
|
||||
|
||||
// future versions should not work as well
|
||||
index = new Engine.Index(newUid("1"), doc, 3l, VersionType.INTERNAL, PRIMARY, 0);
|
||||
index = new Engine.Index(newUid("1"), doc, 3L, VersionType.INTERNAL, PRIMARY, 0);
|
||||
try {
|
||||
engine.index(index);
|
||||
fail();
|
||||
|
@ -956,11 +956,11 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc, 12, VersionType.EXTERNAL, PRIMARY, 0);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(12l));
|
||||
assertThat(index.version(), equalTo(12L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc, 14, VersionType.EXTERNAL, PRIMARY, 0);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(14l));
|
||||
assertThat(index.version(), equalTo(14L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc, 13, VersionType.EXTERNAL, PRIMARY, 0);
|
||||
try {
|
||||
|
@ -975,15 +975,15 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(1l));
|
||||
assertThat(index.version(), equalTo(1L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(2l));
|
||||
assertThat(index.version(), equalTo(2L));
|
||||
|
||||
engine.flush();
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc, 1l, VersionType.INTERNAL, PRIMARY, 0);
|
||||
index = new Engine.Index(newUid("1"), doc, 1L, VersionType.INTERNAL, PRIMARY, 0);
|
||||
try {
|
||||
engine.index(index);
|
||||
fail();
|
||||
|
@ -992,7 +992,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
}
|
||||
|
||||
// future versions should not work as well
|
||||
index = new Engine.Index(newUid("1"), doc, 3l, VersionType.INTERNAL, PRIMARY, 0);
|
||||
index = new Engine.Index(newUid("1"), doc, 3L, VersionType.INTERNAL, PRIMARY, 0);
|
||||
try {
|
||||
engine.index(index);
|
||||
fail();
|
||||
|
@ -1005,11 +1005,11 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc, 12, VersionType.EXTERNAL, PRIMARY, 0);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(12l));
|
||||
assertThat(index.version(), equalTo(12L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc, 14, VersionType.EXTERNAL, PRIMARY, 0);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(14l));
|
||||
assertThat(index.version(), equalTo(14L));
|
||||
|
||||
engine.flush();
|
||||
|
||||
|
@ -1121,13 +1121,13 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(1l));
|
||||
assertThat(index.version(), equalTo(1L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(2l));
|
||||
assertThat(index.version(), equalTo(2L));
|
||||
|
||||
Engine.Delete delete = new Engine.Delete("test", "1", newUid("1"), 1l, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
Engine.Delete delete = new Engine.Delete("test", "1", newUid("1"), 1L, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
try {
|
||||
engine.delete(delete);
|
||||
fail();
|
||||
|
@ -1136,7 +1136,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
}
|
||||
|
||||
// future versions should not work as well
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 3l, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 3L, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
try {
|
||||
engine.delete(delete);
|
||||
fail();
|
||||
|
@ -1145,12 +1145,12 @@ public class InternalEngineTests extends ESTestCase {
|
|||
}
|
||||
|
||||
// now actually delete
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 2l, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 2L, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
engine.delete(delete);
|
||||
assertThat(delete.version(), equalTo(3l));
|
||||
assertThat(delete.version(), equalTo(3L));
|
||||
|
||||
// now check if we can index to a delete doc with version
|
||||
index = new Engine.Index(newUid("1"), doc, 2l, VersionType.INTERNAL, PRIMARY, 0);
|
||||
index = new Engine.Index(newUid("1"), doc, 2L, VersionType.INTERNAL, PRIMARY, 0);
|
||||
try {
|
||||
engine.index(index);
|
||||
fail();
|
||||
|
@ -1171,15 +1171,15 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(1l));
|
||||
assertThat(index.version(), equalTo(1L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(2l));
|
||||
assertThat(index.version(), equalTo(2L));
|
||||
|
||||
engine.flush();
|
||||
|
||||
Engine.Delete delete = new Engine.Delete("test", "1", newUid("1"), 1l, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
Engine.Delete delete = new Engine.Delete("test", "1", newUid("1"), 1L, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
try {
|
||||
engine.delete(delete);
|
||||
fail();
|
||||
|
@ -1188,7 +1188,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
}
|
||||
|
||||
// future versions should not work as well
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 3l, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 3L, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
try {
|
||||
engine.delete(delete);
|
||||
fail();
|
||||
|
@ -1199,14 +1199,14 @@ public class InternalEngineTests extends ESTestCase {
|
|||
engine.flush();
|
||||
|
||||
// now actually delete
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 2l, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 2L, VersionType.INTERNAL, PRIMARY, 0, false);
|
||||
engine.delete(delete);
|
||||
assertThat(delete.version(), equalTo(3l));
|
||||
assertThat(delete.version(), equalTo(3L));
|
||||
|
||||
engine.flush();
|
||||
|
||||
// now check if we can index to a delete doc with version
|
||||
index = new Engine.Index(newUid("1"), doc, 2l, VersionType.INTERNAL, PRIMARY, 0);
|
||||
index = new Engine.Index(newUid("1"), doc, 2L, VersionType.INTERNAL, PRIMARY, 0);
|
||||
try {
|
||||
engine.index(index);
|
||||
fail();
|
||||
|
@ -1227,7 +1227,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index create = new Engine.Index(newUid("1"), doc, Versions.MATCH_DELETED, VersionType.INTERNAL, PRIMARY, 0);
|
||||
engine.index(create);
|
||||
assertThat(create.version(), equalTo(1l));
|
||||
assertThat(create.version(), equalTo(1L));
|
||||
|
||||
create = new Engine.Index(newUid("1"), doc, Versions.MATCH_DELETED, VersionType.INTERNAL, PRIMARY, 0);
|
||||
try {
|
||||
|
@ -1242,7 +1242,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index create = new Engine.Index(newUid("1"), doc, Versions.MATCH_DELETED, VersionType.INTERNAL, PRIMARY, 0);
|
||||
engine.index(create);
|
||||
assertThat(create.version(), equalTo(1l));
|
||||
assertThat(create.version(), equalTo(1L));
|
||||
|
||||
engine.flush();
|
||||
|
||||
|
@ -1259,19 +1259,19 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(1l));
|
||||
assertThat(index.version(), equalTo(1L));
|
||||
|
||||
index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(2l));
|
||||
assertThat(index.version(), equalTo(2L));
|
||||
|
||||
// apply the second index to the replica, should work fine
|
||||
index = new Engine.Index(newUid("1"), doc, index.version(), VersionType.INTERNAL.versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
replicaEngine.index(index);
|
||||
assertThat(index.version(), equalTo(2l));
|
||||
assertThat(index.version(), equalTo(2L));
|
||||
|
||||
// now, the old one should not work
|
||||
index = new Engine.Index(newUid("1"), doc, 1l, VersionType.INTERNAL.versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
index = new Engine.Index(newUid("1"), doc, 1L, VersionType.INTERNAL.versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
try {
|
||||
replicaEngine.index(index);
|
||||
fail();
|
||||
|
@ -1281,10 +1281,10 @@ public class InternalEngineTests extends ESTestCase {
|
|||
|
||||
// second version on replica should fail as well
|
||||
try {
|
||||
index = new Engine.Index(newUid("1"), doc, 2l
|
||||
index = new Engine.Index(newUid("1"), doc, 2L
|
||||
, VersionType.INTERNAL.versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
replicaEngine.index(index);
|
||||
assertThat(index.version(), equalTo(2l));
|
||||
assertThat(index.version(), equalTo(2L));
|
||||
} catch (VersionConflictEngineException e) {
|
||||
// all is well
|
||||
}
|
||||
|
@ -1294,33 +1294,33 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocument(), B_1, null);
|
||||
Engine.Index index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(1l));
|
||||
assertThat(index.version(), equalTo(1L));
|
||||
|
||||
// apply the first index to the replica, should work fine
|
||||
index = new Engine.Index(newUid("1"), doc, 1l
|
||||
index = new Engine.Index(newUid("1"), doc, 1L
|
||||
, VersionType.INTERNAL.versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
replicaEngine.index(index);
|
||||
assertThat(index.version(), equalTo(1l));
|
||||
assertThat(index.version(), equalTo(1L));
|
||||
|
||||
// index it again
|
||||
index = new Engine.Index(newUid("1"), doc);
|
||||
engine.index(index);
|
||||
assertThat(index.version(), equalTo(2l));
|
||||
assertThat(index.version(), equalTo(2L));
|
||||
|
||||
// now delete it
|
||||
Engine.Delete delete = new Engine.Delete("test", "1", newUid("1"));
|
||||
engine.delete(delete);
|
||||
assertThat(delete.version(), equalTo(3l));
|
||||
assertThat(delete.version(), equalTo(3L));
|
||||
|
||||
// apply the delete on the replica (skipping the second index)
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 3l
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 3L
|
||||
, VersionType.INTERNAL.versionTypeForReplicationAndRecovery(), REPLICA, 0, false);
|
||||
replicaEngine.delete(delete);
|
||||
assertThat(delete.version(), equalTo(3l));
|
||||
assertThat(delete.version(), equalTo(3L));
|
||||
|
||||
// second time delete with same version should fail
|
||||
try {
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 3l
|
||||
delete = new Engine.Delete("test", "1", newUid("1"), 3L
|
||||
, VersionType.INTERNAL.versionTypeForReplicationAndRecovery(), REPLICA, 0, false);
|
||||
replicaEngine.delete(delete);
|
||||
fail("excepted VersionConflictEngineException to be thrown");
|
||||
|
@ -1330,7 +1330,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
|
||||
// now do the second index on the replica, it should fail
|
||||
try {
|
||||
index = new Engine.Index(newUid("1"), doc, 2l, VersionType.INTERNAL.versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
index = new Engine.Index(newUid("1"), doc, 2L, VersionType.INTERNAL.versionTypeForReplicationAndRecovery(), REPLICA, 0);
|
||||
replicaEngine.index(index);
|
||||
fail("excepted VersionConflictEngineException to be thrown");
|
||||
} catch (VersionConflictEngineException e) {
|
||||
|
@ -1610,7 +1610,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument(Integer.toString(i), Integer.toString(i), "test", null, -1, -1, testDocument(), new BytesArray("{}"), null);
|
||||
Engine.Index firstIndexRequest = new Engine.Index(newUid(Integer.toString(i)), doc, Versions.MATCH_DELETED, VersionType.INTERNAL, PRIMARY, System.nanoTime());
|
||||
engine.index(firstIndexRequest);
|
||||
assertThat(firstIndexRequest.version(), equalTo(1l));
|
||||
assertThat(firstIndexRequest.version(), equalTo(1L));
|
||||
}
|
||||
engine.refresh("test");
|
||||
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
|
||||
|
@ -1662,7 +1662,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument(Integer.toString(i), Integer.toString(i), "test", null, -1, -1, testDocument(), new BytesArray("{}"), null);
|
||||
Engine.Index firstIndexRequest = new Engine.Index(newUid(Integer.toString(i)), doc, Versions.MATCH_DELETED, VersionType.INTERNAL, PRIMARY, System.nanoTime());
|
||||
engine.index(firstIndexRequest);
|
||||
assertThat(firstIndexRequest.version(), equalTo(1l));
|
||||
assertThat(firstIndexRequest.version(), equalTo(1L));
|
||||
}
|
||||
engine.refresh("test");
|
||||
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
|
||||
|
@ -1757,7 +1757,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument("extra" + Integer.toString(i), "extra" + Integer.toString(i), "test", null, -1, -1, testDocument(), new BytesArray("{}"), null);
|
||||
Engine.Index firstIndexRequest = new Engine.Index(newUid(Integer.toString(i)), doc, Versions.MATCH_DELETED, VersionType.INTERNAL, PRIMARY, System.nanoTime());
|
||||
engine.index(firstIndexRequest);
|
||||
assertThat(firstIndexRequest.version(), equalTo(1l));
|
||||
assertThat(firstIndexRequest.version(), equalTo(1L));
|
||||
}
|
||||
engine.refresh("test");
|
||||
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
|
||||
|
@ -1786,7 +1786,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument(Integer.toString(i), Integer.toString(i), "test", null, -1, -1, testDocument(), new BytesArray("{}"), null);
|
||||
Engine.Index firstIndexRequest = new Engine.Index(newUid(Integer.toString(i)), doc, Versions.MATCH_DELETED, VersionType.INTERNAL, PRIMARY, System.nanoTime());
|
||||
engine.index(firstIndexRequest);
|
||||
assertThat(firstIndexRequest.version(), equalTo(1l));
|
||||
assertThat(firstIndexRequest.version(), equalTo(1L));
|
||||
}
|
||||
engine.refresh("test");
|
||||
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
|
||||
|
@ -1835,7 +1835,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument(uuidValue, Integer.toString(randomId), "test", null, -1, -1, testDocument(), new BytesArray("{}"), null);
|
||||
Engine.Index firstIndexRequest = new Engine.Index(newUid(uuidValue), doc, 1, VersionType.EXTERNAL, PRIMARY, System.nanoTime());
|
||||
engine.index(firstIndexRequest);
|
||||
assertThat(firstIndexRequest.version(), equalTo(1l));
|
||||
assertThat(firstIndexRequest.version(), equalTo(1L));
|
||||
if (flush) {
|
||||
engine.flush();
|
||||
}
|
||||
|
@ -1844,7 +1844,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
Engine.Index idxRequest = new Engine.Index(newUid(uuidValue), doc, 2, VersionType.EXTERNAL, PRIMARY, System.nanoTime());
|
||||
engine.index(idxRequest);
|
||||
engine.refresh("test");
|
||||
assertThat(idxRequest.version(), equalTo(2l));
|
||||
assertThat(idxRequest.version(), equalTo(2L));
|
||||
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
|
||||
TopDocs topDocs = searcher.searcher().search(new MatchAllDocsQuery(), numDocs + 1);
|
||||
assertThat(topDocs.totalHits, equalTo(numDocs + 1));
|
||||
|
@ -1909,7 +1909,7 @@ public class InternalEngineTests extends ESTestCase {
|
|||
ParsedDocument doc = testParsedDocument(Integer.toString(i), Integer.toString(i), "test", null, -1, -1, testDocument(), new BytesArray("{}"), null);
|
||||
Engine.Index firstIndexRequest = new Engine.Index(newUid(Integer.toString(i)), doc, Versions.MATCH_DELETED, VersionType.INTERNAL, PRIMARY, System.nanoTime());
|
||||
engine.index(firstIndexRequest);
|
||||
assertThat(firstIndexRequest.version(), equalTo(1l));
|
||||
assertThat(firstIndexRequest.version(), equalTo(1L));
|
||||
}
|
||||
engine.refresh("test");
|
||||
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
|
||||
|
|
|
@ -252,7 +252,7 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
primaryEngine.index(new Engine.Index(newUid("1"), doc));
|
||||
|
||||
CommitStats stats1 = replicaEngine.commitStats();
|
||||
assertThat(stats1.getGeneration(), greaterThan(0l));
|
||||
assertThat(stats1.getGeneration(), greaterThan(0L));
|
||||
assertThat(stats1.getId(), notNullValue());
|
||||
assertThat(stats1.getUserData(), hasKey(Translog.TRANSLOG_GENERATION_KEY));
|
||||
|
||||
|
@ -276,8 +276,8 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
primaryEngine = createInternalEngine(defaultSettings, store, createTempDir(), NoMergePolicy.INSTANCE);
|
||||
List<Segment> segments = primaryEngine.segments(false);
|
||||
assertThat(segments.isEmpty(), equalTo(true));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(0l));
|
||||
assertThat(primaryEngine.segmentsStats().getMemoryInBytes(), equalTo(0l));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(0L));
|
||||
assertThat(primaryEngine.segmentsStats().getMemoryInBytes(), equalTo(0L));
|
||||
|
||||
// create a doc and refresh
|
||||
ParsedDocument doc = testParsedDocument("1", "1", "test", null, -1, -1, testDocumentWithTextField(), B_1, null);
|
||||
|
@ -290,12 +290,12 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
segments = primaryEngine.segments(false);
|
||||
assertThat(segments.size(), equalTo(1));
|
||||
SegmentsStats stats = primaryEngine.segmentsStats();
|
||||
assertThat(stats.getCount(), equalTo(1l));
|
||||
assertThat(stats.getTermsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getStoredFieldsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTermVectorsMemoryInBytes(), equalTo(0l));
|
||||
assertThat(stats.getNormsMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getDocValuesMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getCount(), equalTo(1L));
|
||||
assertThat(stats.getTermsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getStoredFieldsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTermVectorsMemoryInBytes(), equalTo(0L));
|
||||
assertThat(stats.getNormsMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getDocValuesMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(segments.get(0).isCommitted(), equalTo(false));
|
||||
assertThat(segments.get(0).isSearch(), equalTo(true));
|
||||
assertThat(segments.get(0).getNumDocs(), equalTo(2));
|
||||
|
@ -307,12 +307,12 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
segments = replicaEngine.segments(false);
|
||||
assertThat(segments.size(), equalTo(0));
|
||||
stats = replicaEngine.segmentsStats();
|
||||
assertThat(stats.getCount(), equalTo(0l));
|
||||
assertThat(stats.getTermsMemoryInBytes(), equalTo(0l));
|
||||
assertThat(stats.getStoredFieldsMemoryInBytes(), equalTo(0l));
|
||||
assertThat(stats.getTermVectorsMemoryInBytes(), equalTo(0l));
|
||||
assertThat(stats.getNormsMemoryInBytes(), equalTo(0l));
|
||||
assertThat(stats.getDocValuesMemoryInBytes(), equalTo(0l));
|
||||
assertThat(stats.getCount(), equalTo(0L));
|
||||
assertThat(stats.getTermsMemoryInBytes(), equalTo(0L));
|
||||
assertThat(stats.getStoredFieldsMemoryInBytes(), equalTo(0L));
|
||||
assertThat(stats.getTermVectorsMemoryInBytes(), equalTo(0L));
|
||||
assertThat(stats.getNormsMemoryInBytes(), equalTo(0L));
|
||||
assertThat(stats.getDocValuesMemoryInBytes(), equalTo(0L));
|
||||
assertThat(segments.size(), equalTo(0));
|
||||
|
||||
// flush the primary engine
|
||||
|
@ -323,7 +323,7 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
// Check that the primary AND replica sees segments now
|
||||
segments = primaryEngine.segments(false);
|
||||
assertThat(segments.size(), equalTo(1));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(1l));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(1L));
|
||||
assertThat(segments.get(0).isCommitted(), equalTo(true));
|
||||
assertThat(segments.get(0).isSearch(), equalTo(true));
|
||||
assertThat(segments.get(0).getNumDocs(), equalTo(2));
|
||||
|
@ -332,7 +332,7 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
|
||||
segments = replicaEngine.segments(false);
|
||||
assertThat(segments.size(), equalTo(1));
|
||||
assertThat(replicaEngine.segmentsStats().getCount(), equalTo(1l));
|
||||
assertThat(replicaEngine.segmentsStats().getCount(), equalTo(1L));
|
||||
assertThat(segments.get(0).isCommitted(), equalTo(true));
|
||||
assertThat(segments.get(0).isSearch(), equalTo(true));
|
||||
assertThat(segments.get(0).getNumDocs(), equalTo(2));
|
||||
|
@ -346,10 +346,10 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
|
||||
segments = primaryEngine.segments(false);
|
||||
assertThat(segments.size(), equalTo(2));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(2l));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(2L));
|
||||
assertThat(primaryEngine.segmentsStats().getTermsMemoryInBytes(), greaterThan(stats.getTermsMemoryInBytes()));
|
||||
assertThat(primaryEngine.segmentsStats().getStoredFieldsMemoryInBytes(), greaterThan(stats.getStoredFieldsMemoryInBytes()));
|
||||
assertThat(primaryEngine.segmentsStats().getTermVectorsMemoryInBytes(), equalTo(0l));
|
||||
assertThat(primaryEngine.segmentsStats().getTermVectorsMemoryInBytes(), equalTo(0L));
|
||||
assertThat(primaryEngine.segmentsStats().getNormsMemoryInBytes(), greaterThan(stats.getNormsMemoryInBytes()));
|
||||
assertThat(primaryEngine.segmentsStats().getDocValuesMemoryInBytes(), greaterThan(stats.getDocValuesMemoryInBytes()));
|
||||
assertThat(segments.get(0).getGeneration() < segments.get(1).getGeneration(), equalTo(true));
|
||||
|
@ -370,10 +370,10 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
|
||||
segments = replicaEngine.segments(false);
|
||||
assertThat(segments.size(), equalTo(2));
|
||||
assertThat(replicaEngine.segmentsStats().getCount(), equalTo(2l));
|
||||
assertThat(replicaEngine.segmentsStats().getCount(), equalTo(2L));
|
||||
assertThat(replicaEngine.segmentsStats().getTermsMemoryInBytes(), greaterThan(stats.getTermsMemoryInBytes()));
|
||||
assertThat(replicaEngine.segmentsStats().getStoredFieldsMemoryInBytes(), greaterThan(stats.getStoredFieldsMemoryInBytes()));
|
||||
assertThat(replicaEngine.segmentsStats().getTermVectorsMemoryInBytes(), equalTo(0l));
|
||||
assertThat(replicaEngine.segmentsStats().getTermVectorsMemoryInBytes(), equalTo(0L));
|
||||
assertThat(replicaEngine.segmentsStats().getNormsMemoryInBytes(), greaterThan(stats.getNormsMemoryInBytes()));
|
||||
assertThat(replicaEngine.segmentsStats().getDocValuesMemoryInBytes(), greaterThan(stats.getDocValuesMemoryInBytes()));
|
||||
assertThat(segments.get(0).getGeneration() < segments.get(1).getGeneration(), equalTo(true));
|
||||
|
@ -393,7 +393,7 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
|
||||
segments = primaryEngine.segments(false);
|
||||
assertThat(segments.size(), equalTo(2));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(2l));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(2L));
|
||||
assertThat(segments.get(0).getGeneration() < segments.get(1).getGeneration(), equalTo(true));
|
||||
assertThat(segments.get(0).isCommitted(), equalTo(true));
|
||||
assertThat(segments.get(0).isSearch(), equalTo(true));
|
||||
|
@ -416,7 +416,7 @@ public class ShadowEngineTests extends ESTestCase {
|
|||
|
||||
segments = primaryEngine.segments(false);
|
||||
assertThat(segments.size(), equalTo(3));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(3l));
|
||||
assertThat(primaryEngine.segmentsStats().getCount(), equalTo(3L));
|
||||
assertThat(segments.get(0).getGeneration() < segments.get(1).getGeneration(), equalTo(true));
|
||||
assertThat(segments.get(0).isCommitted(), equalTo(true));
|
||||
assertThat(segments.get(0).isSearch(), equalTo(true));
|
||||
|
|
|
@ -206,7 +206,7 @@ public abstract class AbstractFieldDataImplTestCase extends AbstractFieldDataTes
|
|||
IndexFieldData indexFieldData = getForField("value");
|
||||
AtomicFieldData fieldData = indexFieldData.load(refreshReader());
|
||||
// Some impls (FST) return size 0 and some (PagedBytes) do take size in the case no actual data is loaded
|
||||
assertThat(fieldData.ramBytesUsed(), greaterThanOrEqualTo(0l));
|
||||
assertThat(fieldData.ramBytesUsed(), greaterThanOrEqualTo(0L));
|
||||
|
||||
SortedBinaryDocValues bytesValues = fieldData.getBytesValues();
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ public abstract class AbstractFieldDataTestCase extends ESSingleNodeTestCase {
|
|||
AtomicFieldData previous = null;
|
||||
for (int i = 0; i < max; i++) {
|
||||
AtomicFieldData current = fieldData.load(readerContext);
|
||||
assertThat(current.ramBytesUsed(), equalTo(0l));
|
||||
assertThat(current.ramBytesUsed(), equalTo(0L));
|
||||
if (previous != null) {
|
||||
assertThat(current, not(sameInstance(previous)));
|
||||
}
|
||||
|
|
|
@ -485,17 +485,17 @@ public abstract class AbstractStringFieldDataTestCase extends AbstractFieldDataI
|
|||
values.setDocument(0);
|
||||
assertThat(values.cardinality(), equalTo(2));
|
||||
long ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(3l));
|
||||
assertThat(ord, equalTo(3L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("02"));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(5l));
|
||||
assertThat(ord, equalTo(5L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("04"));
|
||||
values.setDocument(1);
|
||||
assertThat(values.cardinality(), equalTo(0));
|
||||
values.setDocument(2);
|
||||
assertThat(values.cardinality(), equalTo(1));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(4l));
|
||||
assertThat(ord, equalTo(4L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("03"));
|
||||
|
||||
// Second segment
|
||||
|
@ -506,37 +506,37 @@ public abstract class AbstractStringFieldDataTestCase extends AbstractFieldDataI
|
|||
values.setDocument(0);
|
||||
assertThat(values.cardinality(), equalTo(3));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(5l));
|
||||
assertThat(ord, equalTo(5L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("04"));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(6l));
|
||||
assertThat(ord, equalTo(6L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("05"));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(7l));
|
||||
assertThat(ord, equalTo(7L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("06"));
|
||||
values.setDocument(1);
|
||||
assertThat(values.cardinality(), equalTo(3));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(7l));
|
||||
assertThat(ord, equalTo(7L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("06"));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(8l));
|
||||
assertThat(ord, equalTo(8L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("07"));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(9l));
|
||||
assertThat(ord, equalTo(9L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("08"));
|
||||
values.setDocument(2);
|
||||
assertThat(values.cardinality(), equalTo(0));
|
||||
values.setDocument(3);
|
||||
assertThat(values.cardinality(), equalTo(3));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(9l));
|
||||
assertThat(ord, equalTo(9L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("08"));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(10l));
|
||||
assertThat(ord, equalTo(10L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("09"));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(11l));
|
||||
assertThat(ord, equalTo(11L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("10"));
|
||||
|
||||
// Third segment
|
||||
|
@ -548,13 +548,13 @@ public abstract class AbstractStringFieldDataTestCase extends AbstractFieldDataI
|
|||
values.setDocument(0);
|
||||
assertThat(values.cardinality(), equalTo(3));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(0l));
|
||||
assertThat(ord, equalTo(0L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("!08"));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(1l));
|
||||
assertThat(ord, equalTo(1L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("!09"));
|
||||
ord = values.nextOrd();
|
||||
assertThat(ord, equalTo(2l));
|
||||
assertThat(ord, equalTo(2L));
|
||||
assertThat(values.lookupOrd(ord).utf8ToString(), equalTo("!10"));
|
||||
}
|
||||
|
||||
|
@ -620,6 +620,6 @@ public abstract class AbstractStringFieldDataTestCase extends AbstractFieldDataI
|
|||
assertThat(ifd.loadGlobal(topLevelReader), not(sameInstance(globalOrdinals)));
|
||||
|
||||
ifdService.clear();
|
||||
assertThat(indicesFieldDataCache.getCache().weight(), equalTo(0l));
|
||||
assertThat(indicesFieldDataCache.getCache().weight(), equalTo(0L));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class FieldDataLoadingIT extends ESIntegTestCase {
|
|||
client().admin().indices().prepareRefresh("test").get();
|
||||
|
||||
ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get();
|
||||
assertThat(response.getIndicesStats().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(response.getIndicesStats().getFieldData().getMemorySizeInBytes(), greaterThan(0L));
|
||||
}
|
||||
|
||||
public void testEagerGlobalOrdinalsFieldDataLoading() throws Exception {
|
||||
|
@ -60,7 +60,7 @@ public class FieldDataLoadingIT extends ESIntegTestCase {
|
|||
client().admin().indices().prepareRefresh("test").get();
|
||||
|
||||
ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get();
|
||||
assertThat(response.getIndicesStats().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(response.getIndicesStats().getFieldData().getMemorySizeInBytes(), greaterThan(0L));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class CustomBoostMappingTests extends ESSingleNodeTestCase {
|
|||
|
||||
ParsedDocument doc = mapper.parse("test", "type", "1", XContentFactory.jsonBuilder().startObject()
|
||||
.startObject("s_field").field("value", "s_value").field("boost", 2.0f).endObject()
|
||||
.startObject("l_field").field("value", 1l).field("boost", 3.0f).endObject()
|
||||
.startObject("l_field").field("value", 1L).field("boost", 3.0f).endObject()
|
||||
.startObject("i_field").field("value", 1).field("boost", 4.0f).endObject()
|
||||
.startObject("sh_field").field("value", 1).field("boost", 5.0f).endObject()
|
||||
.startObject("b_field").field("value", 1).field("boost", 6.0f).endObject()
|
||||
|
|
|
@ -80,9 +80,9 @@ public class StoredNumericValuesTests extends ESSingleNodeTestCase {
|
|||
Document doc2 = new Document();
|
||||
doc2.add(new StoredField("field1", new BytesRef(Numbers.intToBytes(1))));
|
||||
doc2.add(new StoredField("field2", new BytesRef(Numbers.floatToBytes(1.1f))));
|
||||
doc2.add(new StoredField("field3", new BytesRef(Numbers.longToBytes(1l))));
|
||||
doc2.add(new StoredField("field3", new BytesRef(Numbers.longToBytes(2l))));
|
||||
doc2.add(new StoredField("field3", new BytesRef(Numbers.longToBytes(3l))));
|
||||
doc2.add(new StoredField("field3", new BytesRef(Numbers.longToBytes(1L))));
|
||||
doc2.add(new StoredField("field3", new BytesRef(Numbers.longToBytes(2L))));
|
||||
doc2.add(new StoredField("field3", new BytesRef(Numbers.longToBytes(3L))));
|
||||
writer.addDocument(doc2);
|
||||
|
||||
DirectoryReader reader = DirectoryReader.open(writer, true);
|
||||
|
@ -98,9 +98,9 @@ public class StoredNumericValuesTests extends ESSingleNodeTestCase {
|
|||
assertThat(fieldsVisitor.fields().get("field2").size(), equalTo(1));
|
||||
assertThat((Float) fieldsVisitor.fields().get("field2").get(0), equalTo(1.1f));
|
||||
assertThat(fieldsVisitor.fields().get("field3").size(), equalTo(3));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(0), equalTo(1l));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(1), equalTo(2l));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(2), equalTo(3l));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(0), equalTo(1L));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(1), equalTo(2L));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(2), equalTo(3L));
|
||||
|
||||
// Make sure the doc gets loaded as if it was stored in the new way
|
||||
fieldsVisitor.reset();
|
||||
|
@ -112,9 +112,9 @@ public class StoredNumericValuesTests extends ESSingleNodeTestCase {
|
|||
assertThat(fieldsVisitor.fields().get("field2").size(), equalTo(1));
|
||||
assertThat((Float) fieldsVisitor.fields().get("field2").get(0), equalTo(1.1f));
|
||||
assertThat(fieldsVisitor.fields().get("field3").size(), equalTo(3));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(0), equalTo(1l));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(1), equalTo(2l));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(2), equalTo(3l));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(0), equalTo(1L));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(1), equalTo(2L));
|
||||
assertThat((Long) fieldsVisitor.fields().get("field3").get(2), equalTo(3L));
|
||||
|
||||
reader.close();
|
||||
writer.close();
|
||||
|
|
|
@ -67,11 +67,11 @@ public class MultiFieldsIntegrationIT extends ESIntegTestCase {
|
|||
SearchResponse searchResponse = client().prepareSearch("my-index")
|
||||
.setQuery(matchQuery("title", "multi"))
|
||||
.get();
|
||||
assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(searchResponse.getHits().totalHits(), equalTo(1L));
|
||||
searchResponse = client().prepareSearch("my-index")
|
||||
.setQuery(matchQuery("title.not_analyzed", "Multi fields"))
|
||||
.get();
|
||||
assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(searchResponse.getHits().totalHits(), equalTo(1L));
|
||||
|
||||
assertAcked(
|
||||
client().admin().indices().preparePutMapping("my-index").setType("my-type")
|
||||
|
@ -98,7 +98,7 @@ public class MultiFieldsIntegrationIT extends ESIntegTestCase {
|
|||
searchResponse = client().prepareSearch("my-index")
|
||||
.setQuery(matchQuery("title.uncased", "Multi"))
|
||||
.get();
|
||||
assertThat(searchResponse.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(searchResponse.getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testGeoPointMultiField() throws Exception {
|
||||
|
@ -127,9 +127,9 @@ public class MultiFieldsIntegrationIT extends ESIntegTestCase {
|
|||
SearchResponse countResponse = client().prepareSearch("my-index").setSize(0)
|
||||
.setQuery(constantScoreQuery(geoDistanceQuery("a").point(51, 19).distance(50, DistanceUnit.KILOMETERS)))
|
||||
.get();
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1L));
|
||||
countResponse = client().prepareSearch("my-index").setSize(0).setQuery(matchQuery("a.b", point.toString())).get();
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testTokenCountMultiField() throws Exception {
|
||||
|
@ -167,7 +167,7 @@ public class MultiFieldsIntegrationIT extends ESIntegTestCase {
|
|||
|
||||
client().prepareIndex("my-index", "my-type", "1").setSource("a", "my tokens").setRefresh(true).get();
|
||||
SearchResponse countResponse = client().prepareSearch("my-index").setSize(0).setQuery(matchQuery("a.b", "my tokens")).get();
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testCompletionMultiField() throws Exception {
|
||||
|
@ -192,7 +192,7 @@ public class MultiFieldsIntegrationIT extends ESIntegTestCase {
|
|||
|
||||
client().prepareIndex("my-index", "my-type", "1").setSource("a", "complete me").setRefresh(true).get();
|
||||
SearchResponse countResponse = client().prepareSearch("my-index").setSize(0).setQuery(matchQuery("a.b", "complete me")).get();
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testIpMultiField() throws Exception {
|
||||
|
@ -217,7 +217,7 @@ public class MultiFieldsIntegrationIT extends ESIntegTestCase {
|
|||
|
||||
client().prepareIndex("my-index", "my-type", "1").setSource("a", "127.0.0.1").setRefresh(true).get();
|
||||
SearchResponse countResponse = client().prepareSearch("my-index").setSize(0).setQuery(matchQuery("a.b", "127.0.0.1")).get();
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
private XContentBuilder createMappingSource(String fieldType) throws IOException {
|
||||
|
|
|
@ -141,8 +141,8 @@ public class FuzzyQueryBuilderTests extends AbstractQueryTestCase<FuzzyQueryBuil
|
|||
Query parsedQuery = parseQuery(query).toQuery(createShardContext());
|
||||
assertThat(parsedQuery, instanceOf(NumericRangeQuery.class));
|
||||
NumericRangeQuery fuzzyQuery = (NumericRangeQuery) parsedQuery;
|
||||
assertThat(fuzzyQuery.getMin().longValue(), equalTo(7l));
|
||||
assertThat(fuzzyQuery.getMax().longValue(), equalTo(17l));
|
||||
assertThat(fuzzyQuery.getMin().longValue(), equalTo(7L));
|
||||
assertThat(fuzzyQuery.getMax().longValue(), equalTo(17L));
|
||||
}
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
|
|
|
@ -302,8 +302,8 @@ public class QueryStringQueryBuilderTests extends AbstractQueryTestCase<QueryStr
|
|||
assumeTrue("test runs only when at least a type is registered", getCurrentTypes().length > 0);
|
||||
Query query = queryStringQuery("12~0.2").defaultField(INT_FIELD_NAME).toQuery(createShardContext());
|
||||
NumericRangeQuery fuzzyQuery = (NumericRangeQuery) query;
|
||||
assertThat(fuzzyQuery.getMin().longValue(), equalTo(12l));
|
||||
assertThat(fuzzyQuery.getMax().longValue(), equalTo(12l));
|
||||
assertThat(fuzzyQuery.getMin().longValue(), equalTo(12L));
|
||||
assertThat(fuzzyQuery.getMax().longValue(), equalTo(12L));
|
||||
}
|
||||
|
||||
public void testTimezone() throws Exception {
|
||||
|
|
|
@ -242,7 +242,7 @@ public class TermsQueryBuilderTests extends AbstractQueryTestCase<TermsQueryBuil
|
|||
TermsQueryBuilder builder = new TermsQueryBuilder("foo", new long[]{1, 3, 4});
|
||||
TermsQueryBuilder copy = assertSerialization(builder);
|
||||
List<Object> values = copy.values();
|
||||
assertEquals(Arrays.asList(1l, 3l, 4l), values);
|
||||
assertEquals(Arrays.asList(1L, 3L, 4L), values);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,11 +59,11 @@ public class CustomQueryParserIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testCustomDummyQuery() {
|
||||
assertHitCount(client().prepareSearch("index").setQuery(new DummyQueryParserPlugin.DummyQueryBuilder()).get(), 1l);
|
||||
assertHitCount(client().prepareSearch("index").setQuery(new DummyQueryParserPlugin.DummyQueryBuilder()).get(), 1L);
|
||||
}
|
||||
|
||||
public void testCustomDummyQueryWithinBooleanQuery() {
|
||||
assertHitCount(client().prepareSearch("index").setQuery(new BoolQueryBuilder().must(new DummyQueryParserPlugin.DummyQueryBuilder())).get(), 1l);
|
||||
assertHitCount(client().prepareSearch("index").setQuery(new BoolQueryBuilder().must(new DummyQueryParserPlugin.DummyQueryBuilder())).get(), 1L);
|
||||
}
|
||||
|
||||
private static QueryShardContext queryShardContext() {
|
||||
|
|
|
@ -441,7 +441,7 @@ public class IndexShardTests extends ESSingleNodeTestCase {
|
|||
client().prepareIndex("test", "bar", "1").setSource("{}").setRefresh(true).get();
|
||||
client().admin().indices().prepareFlush("test").get();
|
||||
SearchResponse response = client().prepareSearch("test").get();
|
||||
assertHitCount(response, 1l);
|
||||
assertHitCount(response, 1L);
|
||||
IndicesService indicesService = getInstanceFromNode(IndicesService.class);
|
||||
IndexService test = indicesService.indexService("test");
|
||||
IndexShard shard = test.getShardOrNull(0);
|
||||
|
@ -456,7 +456,7 @@ public class IndexShardTests extends ESSingleNodeTestCase {
|
|||
createIndex("test");
|
||||
ensureGreen("test");
|
||||
response = client().prepareSearch("test").get();
|
||||
assertHitCount(response, 0l);
|
||||
assertHitCount(response, 0L);
|
||||
}
|
||||
|
||||
public void testIndexDirIsDeletedWhenShardRemoved() throws Exception {
|
||||
|
@ -470,7 +470,7 @@ public class IndexShardTests extends ESSingleNodeTestCase {
|
|||
ensureGreen("test");
|
||||
client().prepareIndex("test", "bar", "1").setSource("{}").setRefresh(true).get();
|
||||
SearchResponse response = client().prepareSearch("test").get();
|
||||
assertHitCount(response, 1l);
|
||||
assertHitCount(response, 1L);
|
||||
client().admin().indices().prepareDelete("test").get();
|
||||
assertPathHasBeenCleared(idxPath);
|
||||
}
|
||||
|
@ -995,7 +995,7 @@ public class IndexShardTests extends ESSingleNodeTestCase {
|
|||
MappedFieldType foo = newShard.mapperService().fullName("foo");
|
||||
IndexFieldData.Global ifd = shard.indexFieldDataService().getForField(foo);
|
||||
FieldDataStats before = shard.fieldData().stats("foo");
|
||||
assertThat(before.getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(before.getMemorySizeInBytes(), equalTo(0L));
|
||||
FieldDataStats after = null;
|
||||
try (Engine.Searcher searcher = newShard.acquireSearcher("test")) {
|
||||
assumeTrue("we have to have more than one segment", searcher.getDirectoryReader().leaves().size() > 1);
|
||||
|
@ -1003,7 +1003,7 @@ public class IndexShardTests extends ESSingleNodeTestCase {
|
|||
after = shard.fieldData().stats("foo");
|
||||
assertEquals(after.getEvictions(), before.getEvictions());
|
||||
// If a field doesn't exist an empty IndexFieldData is returned and that isn't cached:
|
||||
assertThat(after.getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(after.getMemorySizeInBytes(), equalTo(0L));
|
||||
}
|
||||
assertEquals(shard.fieldData().stats("foo").getEvictions(), before.getEvictions());
|
||||
assertEquals(shard.fieldData().stats("foo").getMemorySizeInBytes(), after.getMemorySizeInBytes());
|
||||
|
|
|
@ -122,7 +122,7 @@ public class ExceptionRetryIT extends ESIntegTestCase {
|
|||
if (!uniqueIds.add(searchResponse.getHits().getHits()[i].getId())) {
|
||||
if (!found_duplicate_already) {
|
||||
SearchResponse dupIdResponse = client().prepareSearch("index").setQuery(termQuery("_id", searchResponse.getHits().getHits()[i].getId())).setExplain(true).get();
|
||||
assertThat(dupIdResponse.getHits().totalHits(), greaterThan(1l));
|
||||
assertThat(dupIdResponse.getHits().totalHits(), greaterThan(1L));
|
||||
logger.info("found a duplicate id:");
|
||||
for (SearchHit hit : dupIdResponse.getHits()) {
|
||||
logger.info("Doc {} was found on shard {}", hit.getId(), hit.getShard().getShardId());
|
||||
|
@ -134,7 +134,7 @@ public class ExceptionRetryIT extends ESIntegTestCase {
|
|||
}
|
||||
}
|
||||
assertSearchResponse(searchResponse);
|
||||
assertThat(dupCounter, equalTo(0l));
|
||||
assertThat(dupCounter, equalTo(0L));
|
||||
assertHitCount(searchResponse, numDocs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -791,7 +791,7 @@ public class StoreTests extends ESTestCase {
|
|||
public void assertDeleteContent(Store store, DirectoryService service) throws IOException {
|
||||
deleteContent(store.directory());
|
||||
assertThat(Arrays.toString(store.directory().listAll()), store.directory().listAll().length, equalTo(0));
|
||||
assertThat(store.stats().sizeInBytes(), equalTo(0l));
|
||||
assertThat(store.stats().sizeInBytes(), equalTo(0L));
|
||||
assertThat(service.newDirectory().listAll().length, equalTo(0));
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public class SuggestStatsIT extends ESIntegTestCase {
|
|||
IndicesStatsResponse indicesStats = client().admin().indices().prepareStats().execute().actionGet();
|
||||
|
||||
// check current
|
||||
assertThat(indicesStats.getTotal().getSuggest().getCurrent(), equalTo(0l));
|
||||
assertThat(indicesStats.getTotal().getSuggest().getCurrent(), equalTo(0L));
|
||||
|
||||
// check suggest count
|
||||
assertThat(indicesStats.getTotal().getSuggest().getCount(), equalTo((long) (suggestAllIdx * totalShards + suggestIdx1 * shardsIdx1 + suggestIdx2 * shardsIdx2)));
|
||||
|
@ -111,7 +111,7 @@ public class SuggestStatsIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("iter {}, iter1 {}, iter2 {}, {}", suggestAllIdx, suggestIdx1, suggestIdx2, endTime - startTime);
|
||||
// check suggest time
|
||||
assertThat(indicesStats.getTotal().getSuggest().getTimeInMillis(), greaterThan(0l));
|
||||
assertThat(indicesStats.getTotal().getSuggest().getTimeInMillis(), greaterThan(0L));
|
||||
// the upperbound is num shards * total time since we do searches in parallel
|
||||
assertThat(indicesStats.getTotal().getSuggest().getTimeInMillis(), lessThanOrEqualTo(totalShards * (endTime - startTime)));
|
||||
|
||||
|
@ -123,12 +123,12 @@ public class SuggestStatsIT extends ESIntegTestCase {
|
|||
SuggestStats suggestStats = stat.getIndices().getSuggest();
|
||||
logger.info("evaluating {}", stat.getNode());
|
||||
if (nodeIdsWithIndex.contains(stat.getNode().getId())) {
|
||||
assertThat(suggestStats.getCount(), greaterThan(0l));
|
||||
assertThat(suggestStats.getTimeInMillis(), greaterThan(0l));
|
||||
assertThat(suggestStats.getCount(), greaterThan(0L));
|
||||
assertThat(suggestStats.getTimeInMillis(), greaterThan(0L));
|
||||
num++;
|
||||
} else {
|
||||
assertThat(suggestStats.getCount(), equalTo(0l));
|
||||
assertThat(suggestStats.getTimeInMillis(), equalTo(0l));
|
||||
assertThat(suggestStats.getCount(), equalTo(0L));
|
||||
assertThat(suggestStats.getTimeInMillis(), equalTo(0L));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ public class TranslogTests extends ESTestCase {
|
|||
public void testStats() throws IOException {
|
||||
final long firstOperationPosition = translog.getFirstOperationPosition();
|
||||
TranslogStats stats = stats();
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(0l));
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(0L));
|
||||
long lastSize = stats.getTranslogSizeInBytes();
|
||||
assertThat((int) firstOperationPosition, greaterThan(CodecUtil.headerLength(TranslogWriter.TRANSLOG_CODEC)));
|
||||
assertThat(lastSize, equalTo(firstOperationPosition));
|
||||
|
@ -296,14 +296,14 @@ public class TranslogTests extends ESTestCase {
|
|||
translog.add(new Translog.Index("test", "1", new byte[]{1}));
|
||||
stats = stats();
|
||||
total.add(stats);
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(1l));
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(1L));
|
||||
assertThat(stats.getTranslogSizeInBytes(), greaterThan(lastSize));
|
||||
lastSize = stats.getTranslogSizeInBytes();
|
||||
|
||||
translog.add(new Translog.Delete(newUid("2")));
|
||||
stats = stats();
|
||||
total.add(stats);
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(2l));
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(2L));
|
||||
assertThat(stats.getTranslogSizeInBytes(), greaterThan(lastSize));
|
||||
lastSize = stats.getTranslogSizeInBytes();
|
||||
|
||||
|
@ -311,13 +311,13 @@ public class TranslogTests extends ESTestCase {
|
|||
translog.prepareCommit();
|
||||
stats = stats();
|
||||
total.add(stats);
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(3l));
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(3L));
|
||||
assertThat(stats.getTranslogSizeInBytes(), greaterThan(lastSize));
|
||||
|
||||
translog.commit();
|
||||
stats = stats();
|
||||
total.add(stats);
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(0l));
|
||||
assertThat(stats.estimatedNumberOfOperations(), equalTo(0L));
|
||||
assertThat(stats.getTranslogSizeInBytes(), equalTo(firstOperationPosition));
|
||||
assertEquals(6, total.estimatedNumberOfOperations());
|
||||
assertEquals(431, total.getTranslogSizeInBytes());
|
||||
|
@ -983,7 +983,7 @@ public class TranslogTests extends ESTestCase {
|
|||
if (op == prepareOp) {
|
||||
translogGeneration = translog.getGeneration();
|
||||
translog.prepareCommit();
|
||||
assertEquals("expected this to be the first commit", 1l, translogGeneration.translogFileGeneration);
|
||||
assertEquals("expected this to be the first commit", 1L, translogGeneration.translogFileGeneration);
|
||||
assertNotNull(translogGeneration.translogUUID);
|
||||
}
|
||||
}
|
||||
|
@ -1034,7 +1034,7 @@ public class TranslogTests extends ESTestCase {
|
|||
if (op == prepareOp) {
|
||||
translogGeneration = translog.getGeneration();
|
||||
translog.prepareCommit();
|
||||
assertEquals("expected this to be the first commit", 1l, translogGeneration.translogFileGeneration);
|
||||
assertEquals("expected this to be the first commit", 1L, translogGeneration.translogFileGeneration);
|
||||
assertNotNull(translogGeneration.translogUUID);
|
||||
}
|
||||
}
|
||||
|
@ -1090,7 +1090,7 @@ public class TranslogTests extends ESTestCase {
|
|||
if (op == prepareOp) {
|
||||
translogGeneration = translog.getGeneration();
|
||||
translog.prepareCommit();
|
||||
assertEquals("expected this to be the first commit", 1l, translogGeneration.translogFileGeneration);
|
||||
assertEquals("expected this to be the first commit", 1L, translogGeneration.translogFileGeneration);
|
||||
assertNotNull(translogGeneration.translogUUID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -472,19 +472,19 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
|||
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
|
||||
.setQuery(matchAllQuery())
|
||||
.execute().actionGet();
|
||||
assertHitCount(response, 0l);
|
||||
assertHitCount(response, 0L);
|
||||
|
||||
response = client().prepareSearch("test2","test3").setQuery(matchAllQuery())
|
||||
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
|
||||
.execute().actionGet();
|
||||
assertHitCount(response, 0l);
|
||||
assertHitCount(response, 0L);
|
||||
|
||||
//you should still be able to run empty searches without things blowing up
|
||||
response = client().prepareSearch()
|
||||
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
|
||||
.setQuery(matchAllQuery())
|
||||
.execute().actionGet();
|
||||
assertHitCount(response, 1l);
|
||||
assertHitCount(response, 1L);
|
||||
}
|
||||
|
||||
public void testAllMissingStrict() throws Exception {
|
||||
|
|
|
@ -54,7 +54,7 @@ public class IndicesRequestCacheIT extends ESIntegTestCase {
|
|||
assertSearchResponse(r1);
|
||||
|
||||
// The cached is actually used
|
||||
assertThat(client().admin().indices().prepareStats("index").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(client().admin().indices().prepareStats("index").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0L));
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
final SearchResponse r2 = client().prepareSearch("index").setSize(0).setSearchType(SearchType.QUERY_THEN_FETCH)
|
||||
|
|
|
@ -349,10 +349,10 @@ public class IndexRecoveryIT extends ESIntegTestCase {
|
|||
assertThat(recoveryStats.currentAsSource(), equalTo(0));
|
||||
assertThat(recoveryStats.currentAsTarget(), equalTo(0));
|
||||
if (nodeStats.getNode().name().equals(nodeA)) {
|
||||
assertThat("node A throttling should be >0", recoveryStats.throttleTime().millis(), greaterThan(0l));
|
||||
assertThat("node A throttling should be >0", recoveryStats.throttleTime().millis(), greaterThan(0L));
|
||||
}
|
||||
if (nodeStats.getNode().name().equals(nodeB)) {
|
||||
assertThat("node B throttling should be >0 ", recoveryStats.throttleTime().millis(), greaterThan(0l));
|
||||
assertThat("node B throttling should be >0 ", recoveryStats.throttleTime().millis(), greaterThan(0L));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,10 +368,10 @@ public class IndexRecoveryIT extends ESIntegTestCase {
|
|||
assertThat(recoveryStats.currentAsSource(), equalTo(0));
|
||||
assertThat(recoveryStats.currentAsTarget(), equalTo(0));
|
||||
if (nodeStats.getNode().name().equals(nodeA)) {
|
||||
assertThat("node A throttling should be >0", recoveryStats.throttleTime().millis(), greaterThan(0l));
|
||||
assertThat("node A throttling should be >0", recoveryStats.throttleTime().millis(), greaterThan(0L));
|
||||
}
|
||||
if (nodeStats.getNode().name().equals(nodeB)) {
|
||||
assertThat("node B throttling should be >0 ", recoveryStats.throttleTime().millis(), greaterThan(0l));
|
||||
assertThat("node B throttling should be >0 ", recoveryStats.throttleTime().millis(), greaterThan(0L));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,8 +148,8 @@ public class RecoveryStateTests extends ESTestCase {
|
|||
}
|
||||
|
||||
timer.start();
|
||||
assertThat(timer.startTime(), greaterThan(0l));
|
||||
assertThat(timer.stopTime(), equalTo(0l));
|
||||
assertThat(timer.startTime(), greaterThan(0L));
|
||||
assertThat(timer.stopTime(), equalTo(0L));
|
||||
Timer lastRead = streamer.serializeDeserialize();
|
||||
final long time = lastRead.time();
|
||||
assertThat(time, lessThanOrEqualTo(timer.time()));
|
||||
|
@ -164,7 +164,7 @@ public class RecoveryStateTests extends ESTestCase {
|
|||
if (randomBoolean()) {
|
||||
timer.stop();
|
||||
assertThat(timer.stopTime(), greaterThanOrEqualTo(timer.startTime()));
|
||||
assertThat(timer.time(), greaterThan(0l));
|
||||
assertThat(timer.time(), greaterThan(0L));
|
||||
lastRead = streamer.serializeDeserialize();
|
||||
assertThat(lastRead.startTime(), equalTo(timer.startTime()));
|
||||
assertThat(lastRead.time(), equalTo(timer.time()));
|
||||
|
@ -172,13 +172,13 @@ public class RecoveryStateTests extends ESTestCase {
|
|||
}
|
||||
|
||||
timer.reset();
|
||||
assertThat(timer.startTime(), equalTo(0l));
|
||||
assertThat(timer.time(), equalTo(0l));
|
||||
assertThat(timer.stopTime(), equalTo(0l));
|
||||
assertThat(timer.startTime(), equalTo(0L));
|
||||
assertThat(timer.time(), equalTo(0L));
|
||||
assertThat(timer.stopTime(), equalTo(0L));
|
||||
lastRead = streamer.serializeDeserialize();
|
||||
assertThat(lastRead.startTime(), equalTo(0l));
|
||||
assertThat(lastRead.time(), equalTo(0l));
|
||||
assertThat(lastRead.stopTime(), equalTo(0l));
|
||||
assertThat(lastRead.startTime(), equalTo(0L));
|
||||
assertThat(lastRead.time(), equalTo(0L));
|
||||
assertThat(lastRead.stopTime(), equalTo(0L));
|
||||
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ public class RecoveryStateTests extends ESTestCase {
|
|||
assertThat(index.reusedFileCount(), equalTo(totalReused));
|
||||
assertThat(index.totalRecoverFiles(), equalTo(filesToRecover.size()));
|
||||
assertThat(index.recoveredFileCount(), equalTo(0));
|
||||
assertThat(index.recoveredBytes(), equalTo(0l));
|
||||
assertThat(index.recoveredBytes(), equalTo(0L));
|
||||
assertThat(index.recoveredFilesPercent(), equalTo(filesToRecover.size() == 0 ? 100.0f : 0.0f));
|
||||
assertThat(index.recoveredBytesPercent(), equalTo(filesToRecover.size() == 0 ? 100.0f : 0.0f));
|
||||
|
||||
|
@ -296,7 +296,7 @@ public class RecoveryStateTests extends ESTestCase {
|
|||
if (completeRecovery) {
|
||||
assertThat(filesToRecover.size(), equalTo(0));
|
||||
index.stop();
|
||||
assertThat(index.time(), greaterThanOrEqualTo(0l));
|
||||
assertThat(index.time(), greaterThanOrEqualTo(0L));
|
||||
}
|
||||
|
||||
logger.info("testing serialized information");
|
||||
|
@ -457,15 +457,15 @@ public class RecoveryStateTests extends ESTestCase {
|
|||
|
||||
// we don't need to test the time aspect, it's done in the timer test
|
||||
verifyIndex.start();
|
||||
assertThat(verifyIndex.checkIndexTime(), equalTo(0l));
|
||||
assertThat(verifyIndex.checkIndexTime(), equalTo(0L));
|
||||
// force one
|
||||
VerifyIndex lastRead = streamer.serializeDeserialize();
|
||||
assertThat(lastRead.checkIndexTime(), equalTo(0l));
|
||||
assertThat(lastRead.checkIndexTime(), equalTo(0L));
|
||||
|
||||
long took = randomLong();
|
||||
if (took < 0) {
|
||||
took = -took;
|
||||
took = Math.max(0l, took);
|
||||
took = Math.max(0L, took);
|
||||
|
||||
}
|
||||
verifyIndex.checkIndexTime(took);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class StartRecoveryRequestTests extends ESTestCase {
|
|||
true,
|
||||
Store.MetadataSnapshot.EMPTY,
|
||||
RecoveryState.Type.RELOCATION,
|
||||
1l
|
||||
1L
|
||||
|
||||
);
|
||||
ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
|
||||
|
|
|
@ -68,7 +68,7 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase {
|
|||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
SearchResponse countResponse = client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get();
|
||||
assertHitCount(countResponse, 10l);
|
||||
assertHitCount(countResponse, 10L);
|
||||
}
|
||||
|
||||
logger.info("Increasing the number of replicas from 1 to 2");
|
||||
|
@ -98,7 +98,7 @@ public class UpdateNumberOfReplicasIT extends ESIntegTestCase {
|
|||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
SearchResponse countResponse = client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get();
|
||||
assertHitCount(countResponse, 10l);
|
||||
assertHitCount(countResponse, 10L);
|
||||
}
|
||||
|
||||
logger.info("Decreasing number of replicas from 2 to 0");
|
||||
|
|
|
@ -205,7 +205,7 @@ public class UpdateSettingsIT extends ESIntegTestCase {
|
|||
// No merge IO throttling should have happened:
|
||||
NodesStatsResponse nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true).get();
|
||||
for(NodeStats stats : nodesStats.getNodes()) {
|
||||
assertThat(stats.getIndices().getStore().getThrottleTime().getMillis(), equalTo(0l));
|
||||
assertThat(stats.getIndices().getStore().getThrottleTime().getMillis(), equalTo(0L));
|
||||
}
|
||||
|
||||
logger.info("test: set low merge throttling");
|
||||
|
|
|
@ -92,18 +92,18 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
|
||||
NodesStatsResponse nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true).execute().actionGet();
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0L));
|
||||
IndicesStatsResponse indicesStats = client().admin().indices().prepareStats("test").clear().setFieldData(true).execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), equalTo(0L));
|
||||
|
||||
// sort to load it to field data...
|
||||
client().prepareSearch().addSort("field", SortOrder.ASC).execute().actionGet();
|
||||
client().prepareSearch().addSort("field", SortOrder.ASC).execute().actionGet();
|
||||
|
||||
nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true).execute().actionGet();
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), greaterThan(0L));
|
||||
indicesStats = client().admin().indices().prepareStats("test").clear().setFieldData(true).execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), greaterThan(0L));
|
||||
|
||||
// sort to load it to field data...
|
||||
client().prepareSearch().addSort("field2", SortOrder.ASC).execute().actionGet();
|
||||
|
@ -111,20 +111,20 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
|
||||
// now check the per field stats
|
||||
nodesStats = client().admin().cluster().prepareNodesStats().setIndices(new CommonStatsFlags().set(CommonStatsFlags.Flag.FieldData, true).fieldDataFields("*")).execute().actionGet();
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getFields().get("field") + nodesStats.getNodes()[1].getIndices().getFieldData().getFields().get("field"), greaterThan(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), greaterThan(0L));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getFields().get("field") + nodesStats.getNodes()[1].getIndices().getFieldData().getFields().get("field"), greaterThan(0L));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getFields().get("field") + nodesStats.getNodes()[1].getIndices().getFieldData().getFields().get("field"), lessThan(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes()));
|
||||
|
||||
indicesStats = client().admin().indices().prepareStats("test").clear().setFieldData(true).setFieldDataFields("*").execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getFields().get("field"), greaterThan(0l));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), greaterThan(0L));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getFields().get("field"), greaterThan(0L));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getFields().get("field"), lessThan(indicesStats.getTotal().getFieldData().getMemorySizeInBytes()));
|
||||
|
||||
client().admin().indices().prepareClearCache().setFieldDataCache(true).execute().actionGet();
|
||||
nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true).execute().actionGet();
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0L));
|
||||
indicesStats = client().admin().indices().prepareStats("test").clear().setFieldData(true).execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), equalTo(0L));
|
||||
|
||||
}
|
||||
|
||||
|
@ -140,14 +140,14 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
|
||||
NodesStatsResponse nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true)
|
||||
.execute().actionGet();
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getQueryCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getQueryCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0L));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getQueryCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getQueryCache().getMemorySizeInBytes(), equalTo(0L));
|
||||
|
||||
IndicesStatsResponse indicesStats = client().admin().indices().prepareStats("test")
|
||||
.clear().setFieldData(true).setQueryCache(true)
|
||||
.execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(indicesStats.getTotal().getQueryCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), equalTo(0L));
|
||||
assertThat(indicesStats.getTotal().getQueryCache().getMemorySizeInBytes(), equalTo(0L));
|
||||
|
||||
// sort to load it to field data and filter to load filter cache
|
||||
client().prepareSearch()
|
||||
|
@ -161,27 +161,27 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
|
||||
nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true)
|
||||
.execute().actionGet();
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getQueryCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getQueryCache().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), greaterThan(0L));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getQueryCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getQueryCache().getMemorySizeInBytes(), greaterThan(0L));
|
||||
|
||||
indicesStats = client().admin().indices().prepareStats("test")
|
||||
.clear().setFieldData(true).setQueryCache(true)
|
||||
.execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(indicesStats.getTotal().getQueryCache().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), greaterThan(0L));
|
||||
assertThat(indicesStats.getTotal().getQueryCache().getMemorySizeInBytes(), greaterThan(0L));
|
||||
|
||||
client().admin().indices().prepareClearCache().execute().actionGet();
|
||||
Thread.sleep(100); // Make sure the filter cache entries have been removed...
|
||||
nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true)
|
||||
.execute().actionGet();
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getQueryCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getQueryCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getFieldData().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getFieldData().getMemorySizeInBytes(), equalTo(0L));
|
||||
assertThat(nodesStats.getNodes()[0].getIndices().getQueryCache().getMemorySizeInBytes() + nodesStats.getNodes()[1].getIndices().getQueryCache().getMemorySizeInBytes(), equalTo(0L));
|
||||
|
||||
indicesStats = client().admin().indices().prepareStats("test")
|
||||
.clear().setFieldData(true).setQueryCache(true)
|
||||
.execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(indicesStats.getTotal().getQueryCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(indicesStats.getTotal().getFieldData().getMemorySizeInBytes(), equalTo(0L));
|
||||
assertThat(indicesStats.getTotal().getQueryCache().getMemorySizeInBytes(), equalTo(0L));
|
||||
}
|
||||
|
||||
public void testQueryCache() throws Exception {
|
||||
|
@ -218,15 +218,15 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(), equalTo(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMissCount(), equalTo(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0L));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(), equalTo(0L));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMissCount(), equalTo(0L));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0L));
|
||||
}
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(), greaterThan(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMissCount(), greaterThan(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getHitCount(), greaterThan(0L));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMissCount(), greaterThan(0L));
|
||||
|
||||
// index the data again...
|
||||
IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs];
|
||||
|
@ -242,25 +242,25 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
assertBusy(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0L));
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0L));
|
||||
}
|
||||
|
||||
client().admin().indices().prepareClearCache().setRequestCache(true).get(); // clean the cache
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0L));
|
||||
|
||||
// test explicit request parameter
|
||||
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).setRequestCache(false).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0L));
|
||||
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).setRequestCache(true).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0L));
|
||||
|
||||
// set the index level setting to false, and see that the reverse works
|
||||
|
||||
|
@ -268,10 +268,10 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
assertAcked(client().admin().indices().prepareUpdateSettings("idx").setSettings(Settings.builder().put(IndicesRequestCache.INDEX_CACHE_REQUEST_ENABLED_SETTING.getKey(), false)));
|
||||
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), equalTo(0L));
|
||||
|
||||
assertThat(client().prepareSearch("idx").setSearchType(SearchType.QUERY_THEN_FETCH).setSize(0).setRequestCache(true).get().getHits().getTotalHits(), equalTo((long) numDocs));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(client().admin().indices().prepareStats("idx").setRequestCache(true).get().getTotal().getRequestCache().getMemorySizeInBytes(), greaterThan(0L));
|
||||
}
|
||||
|
||||
public void testNonThrottleStats() throws Exception {
|
||||
|
@ -303,7 +303,7 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
//nodesStats = client().admin().cluster().prepareNodesStats().setIndices(true).get();
|
||||
|
||||
stats = client().admin().indices().prepareStats().execute().actionGet();
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().getThrottleTime().millis(), equalTo(0l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().getThrottleTime().millis(), equalTo(0L));
|
||||
}
|
||||
|
||||
public void testThrottleStats() throws Exception {
|
||||
|
@ -370,33 +370,33 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
long totalExpectedWrites = test1ExpectedWrites + test2ExpectedWrites;
|
||||
|
||||
IndicesStatsResponse stats = client().admin().indices().prepareStats().execute().actionGet();
|
||||
assertThat(stats.getPrimaries().getDocs().getCount(), equalTo(3l));
|
||||
assertThat(stats.getPrimaries().getDocs().getCount(), equalTo(3L));
|
||||
assertThat(stats.getTotal().getDocs().getCount(), equalTo(totalExpectedWrites));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().getIndexCount(), equalTo(3l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().getIndexFailedCount(), equalTo(0l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().getIndexCount(), equalTo(3L));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().getIndexFailedCount(), equalTo(0L));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().isThrottled(), equalTo(false));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().getThrottleTime().millis(), equalTo(0l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTotal().getThrottleTime().millis(), equalTo(0L));
|
||||
assertThat(stats.getTotal().getIndexing().getTotal().getIndexCount(), equalTo(totalExpectedWrites));
|
||||
assertThat(stats.getTotal().getStore(), notNullValue());
|
||||
assertThat(stats.getTotal().getMerge(), notNullValue());
|
||||
assertThat(stats.getTotal().getFlush(), notNullValue());
|
||||
assertThat(stats.getTotal().getRefresh(), notNullValue());
|
||||
|
||||
assertThat(stats.getIndex("test1").getPrimaries().getDocs().getCount(), equalTo(2l));
|
||||
assertThat(stats.getIndex("test1").getPrimaries().getDocs().getCount(), equalTo(2L));
|
||||
assertThat(stats.getIndex("test1").getTotal().getDocs().getCount(), equalTo(test1ExpectedWrites));
|
||||
assertThat(stats.getIndex("test1").getPrimaries().getStore(), notNullValue());
|
||||
assertThat(stats.getIndex("test1").getPrimaries().getMerge(), notNullValue());
|
||||
assertThat(stats.getIndex("test1").getPrimaries().getFlush(), notNullValue());
|
||||
assertThat(stats.getIndex("test1").getPrimaries().getRefresh(), notNullValue());
|
||||
|
||||
assertThat(stats.getIndex("test2").getPrimaries().getDocs().getCount(), equalTo(1l));
|
||||
assertThat(stats.getIndex("test2").getPrimaries().getDocs().getCount(), equalTo(1L));
|
||||
assertThat(stats.getIndex("test2").getTotal().getDocs().getCount(), equalTo(test2ExpectedWrites));
|
||||
|
||||
// make sure that number of requests in progress is 0
|
||||
assertThat(stats.getIndex("test1").getTotal().getIndexing().getTotal().getIndexCurrent(), equalTo(0l));
|
||||
assertThat(stats.getIndex("test1").getTotal().getIndexing().getTotal().getDeleteCurrent(), equalTo(0l));
|
||||
assertThat(stats.getIndex("test1").getTotal().getSearch().getTotal().getFetchCurrent(), equalTo(0l));
|
||||
assertThat(stats.getIndex("test1").getTotal().getSearch().getTotal().getQueryCurrent(), equalTo(0l));
|
||||
assertThat(stats.getIndex("test1").getTotal().getIndexing().getTotal().getIndexCurrent(), equalTo(0L));
|
||||
assertThat(stats.getIndex("test1").getTotal().getIndexing().getTotal().getDeleteCurrent(), equalTo(0L));
|
||||
assertThat(stats.getIndex("test1").getTotal().getSearch().getTotal().getFetchCurrent(), equalTo(0L));
|
||||
assertThat(stats.getIndex("test1").getTotal().getSearch().getTotal().getQueryCurrent(), equalTo(0L));
|
||||
|
||||
// check flags
|
||||
stats = client().admin().indices().prepareStats().clear()
|
||||
|
@ -414,32 +414,32 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
|
||||
// check types
|
||||
stats = client().admin().indices().prepareStats().setTypes("type1", "type").execute().actionGet();
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type1").getIndexCount(), equalTo(1l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type").getIndexCount(), equalTo(1l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type1").getIndexFailedCount(), equalTo(0l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type1").getIndexCount(), equalTo(1L));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type").getIndexCount(), equalTo(1L));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type1").getIndexFailedCount(), equalTo(0L));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type2"), nullValue());
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type1").getIndexCurrent(), equalTo(0l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type1").getDeleteCurrent(), equalTo(0l));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type1").getIndexCurrent(), equalTo(0L));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type1").getDeleteCurrent(), equalTo(0L));
|
||||
|
||||
|
||||
assertThat(stats.getTotal().getGet().getCount(), equalTo(0l));
|
||||
assertThat(stats.getTotal().getGet().getCount(), equalTo(0L));
|
||||
// check get
|
||||
GetResponse getResponse = client().prepareGet("test1", "type1", "1").execute().actionGet();
|
||||
assertThat(getResponse.isExists(), equalTo(true));
|
||||
|
||||
stats = client().admin().indices().prepareStats().execute().actionGet();
|
||||
assertThat(stats.getTotal().getGet().getCount(), equalTo(1l));
|
||||
assertThat(stats.getTotal().getGet().getExistsCount(), equalTo(1l));
|
||||
assertThat(stats.getTotal().getGet().getMissingCount(), equalTo(0l));
|
||||
assertThat(stats.getTotal().getGet().getCount(), equalTo(1L));
|
||||
assertThat(stats.getTotal().getGet().getExistsCount(), equalTo(1L));
|
||||
assertThat(stats.getTotal().getGet().getMissingCount(), equalTo(0L));
|
||||
|
||||
// missing get
|
||||
getResponse = client().prepareGet("test1", "type1", "2").execute().actionGet();
|
||||
assertThat(getResponse.isExists(), equalTo(false));
|
||||
|
||||
stats = client().admin().indices().prepareStats().execute().actionGet();
|
||||
assertThat(stats.getTotal().getGet().getCount(), equalTo(2l));
|
||||
assertThat(stats.getTotal().getGet().getExistsCount(), equalTo(1l));
|
||||
assertThat(stats.getTotal().getGet().getMissingCount(), equalTo(1l));
|
||||
assertThat(stats.getTotal().getGet().getCount(), equalTo(2L));
|
||||
assertThat(stats.getTotal().getGet().getExistsCount(), equalTo(1L));
|
||||
assertThat(stats.getTotal().getGet().getMissingCount(), equalTo(1L));
|
||||
|
||||
// clear all
|
||||
stats = client().admin().indices().prepareStats()
|
||||
|
@ -476,8 +476,8 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
} catch (VersionConflictEngineException e) {}
|
||||
|
||||
stats = client().admin().indices().prepareStats().setTypes("type1", "type2").execute().actionGet();
|
||||
assertThat(stats.getIndex("test1").getTotal().getIndexing().getTotal().getIndexFailedCount(), equalTo(2l));
|
||||
assertThat(stats.getIndex("test2").getTotal().getIndexing().getTotal().getIndexFailedCount(), equalTo(1l));
|
||||
assertThat(stats.getIndex("test1").getTotal().getIndexing().getTotal().getIndexFailedCount(), equalTo(2L));
|
||||
assertThat(stats.getIndex("test2").getTotal().getIndexing().getTotal().getIndexFailedCount(), equalTo(1L));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type1").getIndexFailedCount(), equalTo(1L));
|
||||
assertThat(stats.getPrimaries().getIndexing().getTypeStats().get("type2").getIndexFailedCount(), equalTo(1L));
|
||||
assertThat(stats.getTotal().getIndexing().getTotal().getIndexFailedCount(), equalTo(3L));
|
||||
|
@ -516,7 +516,7 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
.execute().actionGet();
|
||||
|
||||
assertThat(stats.getTotal().getMerge(), notNullValue());
|
||||
assertThat(stats.getTotal().getMerge().getTotal(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().getMerge().getTotal(), greaterThan(0L));
|
||||
}
|
||||
|
||||
public void testSegmentsStats() {
|
||||
|
@ -531,9 +531,9 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
IndicesStatsResponse stats = client().admin().indices().prepareStats().setSegments(true).get();
|
||||
assertThat(stats.getTotal().getSegments().getIndexWriterMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().getSegments().getIndexWriterMaxMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().getSegments().getVersionMapMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().getSegments().getIndexWriterMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().getSegments().getIndexWriterMaxMemoryInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().getSegments().getVersionMapMemoryInBytes(), greaterThan(0L));
|
||||
|
||||
client().admin().indices().prepareFlush().get();
|
||||
client().admin().indices().prepareForceMerge().setMaxNumSegments(1).execute().actionGet();
|
||||
|
@ -542,7 +542,7 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
assertThat(stats.getTotal().getSegments(), notNullValue());
|
||||
assertThat(stats.getTotal().getSegments().getCount(), equalTo((long) test1.totalNumShards));
|
||||
assumeTrue("test doesn't work with 4.6.0", org.elasticsearch.Version.CURRENT.luceneVersion != Version.LUCENE_4_6_0);
|
||||
assertThat(stats.getTotal().getSegments().getMemoryInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().getSegments().getMemoryInBytes(), greaterThan(0L));
|
||||
}
|
||||
|
||||
public void testAllFlags() throws Exception {
|
||||
|
@ -713,33 +713,33 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
IndicesStatsRequestBuilder builder = client().admin().indices().prepareStats();
|
||||
IndicesStatsResponse stats = builder.execute().actionGet();
|
||||
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().fieldData.getFields(), is(nullValue()));
|
||||
|
||||
stats = builder.setFieldDataFields("bar").execute().actionGet();
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().fieldData.getFields().containsKey("bar"), is(true));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("bar"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("bar"), greaterThan(0L));
|
||||
assertThat(stats.getTotal().fieldData.getFields().containsKey("baz"), is(false));
|
||||
|
||||
stats = builder.setFieldDataFields("bar", "baz").execute().actionGet();
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().fieldData.getFields().containsKey("bar"), is(true));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("bar"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("bar"), greaterThan(0L));
|
||||
assertThat(stats.getTotal().fieldData.getFields().containsKey("baz"), is(true));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("baz"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("baz"), greaterThan(0L));
|
||||
|
||||
stats = builder.setFieldDataFields("*").execute().actionGet();
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().fieldData.getFields().containsKey("bar"), is(true));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("bar"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("bar"), greaterThan(0L));
|
||||
assertThat(stats.getTotal().fieldData.getFields().containsKey("baz"), is(true));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("baz"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("baz"), greaterThan(0L));
|
||||
|
||||
stats = builder.setFieldDataFields("*r").execute().actionGet();
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getMemorySizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().fieldData.getFields().containsKey("bar"), is(true));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("bar"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().fieldData.getFields().get("bar"), greaterThan(0L));
|
||||
assertThat(stats.getTotal().fieldData.getFields().containsKey("baz"), is(false));
|
||||
|
||||
}
|
||||
|
@ -758,33 +758,33 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
IndicesStatsRequestBuilder builder = client().admin().indices().prepareStats();
|
||||
IndicesStatsResponse stats = builder.execute().actionGet();
|
||||
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().completion.getFields(), is(nullValue()));
|
||||
|
||||
stats = builder.setCompletionFields("bar.completion").execute().actionGet();
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().completion.getFields().containsKey("bar.completion"), is(true));
|
||||
assertThat(stats.getTotal().completion.getFields().get("bar.completion"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getFields().get("bar.completion"), greaterThan(0L));
|
||||
assertThat(stats.getTotal().completion.getFields().containsKey("baz.completion"), is(false));
|
||||
|
||||
stats = builder.setCompletionFields("bar.completion", "baz.completion").execute().actionGet();
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().completion.getFields().containsKey("bar.completion"), is(true));
|
||||
assertThat(stats.getTotal().completion.getFields().get("bar.completion"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getFields().get("bar.completion"), greaterThan(0L));
|
||||
assertThat(stats.getTotal().completion.getFields().containsKey("baz.completion"), is(true));
|
||||
assertThat(stats.getTotal().completion.getFields().get("baz.completion"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getFields().get("baz.completion"), greaterThan(0L));
|
||||
|
||||
stats = builder.setCompletionFields("*").execute().actionGet();
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().completion.getFields().containsKey("bar.completion"), is(true));
|
||||
assertThat(stats.getTotal().completion.getFields().get("bar.completion"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getFields().get("bar.completion"), greaterThan(0L));
|
||||
assertThat(stats.getTotal().completion.getFields().containsKey("baz.completion"), is(true));
|
||||
assertThat(stats.getTotal().completion.getFields().get("baz.completion"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getFields().get("baz.completion"), greaterThan(0L));
|
||||
|
||||
stats = builder.setCompletionFields("*r*").execute().actionGet();
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getSizeInBytes(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().completion.getFields().containsKey("bar.completion"), is(true));
|
||||
assertThat(stats.getTotal().completion.getFields().get("bar.completion"), greaterThan(0l));
|
||||
assertThat(stats.getTotal().completion.getFields().get("bar.completion"), greaterThan(0L));
|
||||
assertThat(stats.getTotal().completion.getFields().containsKey("baz.completion"), is(false));
|
||||
|
||||
}
|
||||
|
@ -802,23 +802,23 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
IndicesStatsRequestBuilder builder = client().admin().indices().prepareStats();
|
||||
IndicesStatsResponse stats = builder.execute().actionGet();
|
||||
|
||||
assertThat(stats.getTotal().search.getTotal().getQueryCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().search.getTotal().getQueryCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().search.getGroupStats(), is(nullValue()));
|
||||
|
||||
stats = builder.setGroups("bar").execute().actionGet();
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("bar").getQueryCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("bar").getQueryCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().search.getGroupStats().containsKey("baz"), is(false));
|
||||
|
||||
stats = builder.setGroups("bar", "baz").execute().actionGet();
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("bar").getQueryCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("baz").getQueryCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("bar").getQueryCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("baz").getQueryCount(), greaterThan(0L));
|
||||
|
||||
stats = builder.setGroups("*").execute().actionGet();
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("bar").getQueryCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("baz").getQueryCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("bar").getQueryCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("baz").getQueryCount(), greaterThan(0L));
|
||||
|
||||
stats = builder.setGroups("*r").execute().actionGet();
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("bar").getQueryCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().search.getGroupStats().get("bar").getQueryCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().search.getGroupStats().containsKey("baz"), is(false));
|
||||
|
||||
}
|
||||
|
@ -836,23 +836,23 @@ public class IndexStatsIT extends ESIntegTestCase {
|
|||
IndicesStatsRequestBuilder builder = client().admin().indices().prepareStats();
|
||||
IndicesStatsResponse stats = builder.execute().actionGet();
|
||||
|
||||
assertThat(stats.getTotal().indexing.getTotal().getIndexCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().indexing.getTotal().getIndexCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats(), is(nullValue()));
|
||||
|
||||
stats = builder.setTypes("bar").execute().actionGet();
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("bar").getIndexCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("bar").getIndexCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().containsKey("baz"), is(false));
|
||||
|
||||
stats = builder.setTypes("bar", "baz").execute().actionGet();
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("bar").getIndexCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("baz").getIndexCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("bar").getIndexCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("baz").getIndexCount(), greaterThan(0L));
|
||||
|
||||
stats = builder.setTypes("*").execute().actionGet();
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("bar").getIndexCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("baz").getIndexCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("bar").getIndexCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("baz").getIndexCount(), greaterThan(0L));
|
||||
|
||||
stats = builder.setTypes("*r").execute().actionGet();
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("bar").getIndexCount(), greaterThan(0l));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().get("bar").getIndexCount(), greaterThan(0L));
|
||||
assertThat(stats.getTotal().indexing.getTypeStats().containsKey("baz"), is(false));
|
||||
|
||||
}
|
||||
|
|
|
@ -369,21 +369,21 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
|
|||
refresh();
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("test_index").get();
|
||||
assertHitCount(searchResponse, 5l);
|
||||
assertHitCount(searchResponse, 5L);
|
||||
|
||||
searchResponse = client().prepareSearch("simple_alias").get();
|
||||
assertHitCount(searchResponse, 5l);
|
||||
assertHitCount(searchResponse, 5L);
|
||||
|
||||
searchResponse = client().prepareSearch("templated_alias-test_index").get();
|
||||
assertHitCount(searchResponse, 5l);
|
||||
assertHitCount(searchResponse, 5L);
|
||||
|
||||
searchResponse = client().prepareSearch("filtered_alias").get();
|
||||
assertHitCount(searchResponse, 1l);
|
||||
assertHitCount(searchResponse, 1L);
|
||||
assertThat(searchResponse.getHits().getAt(0).type(), equalTo("type2"));
|
||||
|
||||
// Search the complex filter alias
|
||||
searchResponse = client().prepareSearch("complex_filtered_alias").get();
|
||||
assertHitCount(searchResponse, 3l);
|
||||
assertHitCount(searchResponse, 3L);
|
||||
|
||||
Set<String> types = new HashSet<>();
|
||||
for (SearchHit searchHit : searchResponse.getHits().getHits()) {
|
||||
|
@ -421,10 +421,10 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
|
|||
refresh();
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("test_index").get();
|
||||
assertHitCount(searchResponse, 2l);
|
||||
assertHitCount(searchResponse, 2L);
|
||||
|
||||
searchResponse = client().prepareSearch("my_alias").get();
|
||||
assertHitCount(searchResponse, 1l);
|
||||
assertHitCount(searchResponse, 1L);
|
||||
assertThat(searchResponse.getHits().getAt(0).type(), equalTo("type2"));
|
||||
}
|
||||
|
||||
|
@ -456,13 +456,13 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
|
|||
refresh();
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("test_index").get();
|
||||
assertHitCount(searchResponse, 2l);
|
||||
assertHitCount(searchResponse, 2L);
|
||||
|
||||
searchResponse = client().prepareSearch("alias1").get();
|
||||
assertHitCount(searchResponse, 2l);
|
||||
assertHitCount(searchResponse, 2L);
|
||||
|
||||
searchResponse = client().prepareSearch("alias2").get();
|
||||
assertHitCount(searchResponse, 1l);
|
||||
assertHitCount(searchResponse, 1L);
|
||||
assertThat(searchResponse.getHits().getAt(0).type(), equalTo("type2"));
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,7 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
|
|||
assertThat(response.getItems()[0].getIndex(), equalTo("a2"));
|
||||
assertThat(response.getItems()[0].getType(), equalTo("test"));
|
||||
assertThat(response.getItems()[0].getId(), equalTo("test"));
|
||||
assertThat(response.getItems()[0].getVersion(), equalTo(1l));
|
||||
assertThat(response.getItems()[0].getVersion(), equalTo(1L));
|
||||
|
||||
client().prepareIndex("b1", "test", "test").setSource("{}").get();
|
||||
response = client().prepareBulk().add(new IndexRequest("b2", "test", "test").source("{}")).get();
|
||||
|
@ -636,7 +636,7 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
|
|||
assertThat(response.getItems()[0].getIndex(), equalTo("b2"));
|
||||
assertThat(response.getItems()[0].getType(), equalTo("test"));
|
||||
assertThat(response.getItems()[0].getId(), equalTo("test"));
|
||||
assertThat(response.getItems()[0].getVersion(), equalTo(1l));
|
||||
assertThat(response.getItems()[0].getVersion(), equalTo(1L));
|
||||
|
||||
client().prepareIndex("c1", "test", "test").setSource("{}").get();
|
||||
response = client().prepareBulk().add(new IndexRequest("c2", "test", "test").source("{}")).get();
|
||||
|
@ -645,7 +645,7 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
|
|||
assertThat(response.getItems()[0].getIndex(), equalTo("c2"));
|
||||
assertThat(response.getItems()[0].getType(), equalTo("test"));
|
||||
assertThat(response.getItems()[0].getId(), equalTo("test"));
|
||||
assertThat(response.getItems()[0].getVersion(), equalTo(1l));
|
||||
assertThat(response.getItems()[0].getVersion(), equalTo(1L));
|
||||
|
||||
// Before 2.0 alias filters were parsed at alias creation time, in order
|
||||
// for filters to work correctly ES required that fields mentioned in those
|
||||
|
@ -661,7 +661,7 @@ public class SimpleIndexTemplateIT extends ESIntegTestCase {
|
|||
assertThat(response.hasFailures(), is(false));
|
||||
assertThat(response.getItems()[0].isFailed(), equalTo(false));
|
||||
assertThat(response.getItems()[0].getId(), equalTo("test"));
|
||||
assertThat(response.getItems()[0].getVersion(), equalTo(1l));
|
||||
assertThat(response.getItems()[0].getVersion(), equalTo(1L));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ public class ConcurrentPercolatorIT extends ESIntegTestCase {
|
|||
throw new IllegalStateException("Illegal x=" + x);
|
||||
}
|
||||
assertThat(response.getId(), equalTo(id));
|
||||
assertThat(response.getVersion(), equalTo(1l));
|
||||
assertThat(response.getVersion(), equalTo(1L));
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
exceptionsHolder.add(t);
|
||||
|
|
|
@ -96,7 +96,7 @@ public class MultiPercolatorIT extends ESIntegTestCase {
|
|||
.execute().actionGet();
|
||||
|
||||
MultiPercolateResponse.Item item = response.getItems()[0];
|
||||
assertMatchCount(item.getResponse(), 2l);
|
||||
assertMatchCount(item.getResponse(), 2L);
|
||||
assertThat(item.getResponse().getMatches(), arrayWithSize(2));
|
||||
assertThat(item.getErrorMessage(), nullValue());
|
||||
assertThat(convertFromTextArray(item.getResponse().getMatches(), "test"), arrayContainingInAnyOrder("1", "4"));
|
||||
|
@ -104,18 +104,18 @@ public class MultiPercolatorIT extends ESIntegTestCase {
|
|||
item = response.getItems()[1];
|
||||
assertThat(item.getErrorMessage(), nullValue());
|
||||
|
||||
assertMatchCount(item.getResponse(), 2l);
|
||||
assertMatchCount(item.getResponse(), 2L);
|
||||
assertThat(item.getResponse().getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(item.getResponse().getMatches(), "test"), arrayContainingInAnyOrder("2", "4"));
|
||||
|
||||
item = response.getItems()[2];
|
||||
assertThat(item.getErrorMessage(), nullValue());
|
||||
assertMatchCount(item.getResponse(), 4l);
|
||||
assertMatchCount(item.getResponse(), 4L);
|
||||
assertThat(convertFromTextArray(item.getResponse().getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4"));
|
||||
|
||||
item = response.getItems()[3];
|
||||
assertThat(item.getErrorMessage(), nullValue());
|
||||
assertMatchCount(item.getResponse(), 1l);
|
||||
assertMatchCount(item.getResponse(), 1L);
|
||||
assertThat(item.getResponse().getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(item.getResponse().getMatches(), "test"), arrayContaining("4"));
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class MultiPercolatorIT extends ESIntegTestCase {
|
|||
.execute().actionGet();
|
||||
|
||||
MultiPercolateResponse.Item item = response.getItems()[0];
|
||||
assertMatchCount(item.getResponse(), 2l);
|
||||
assertMatchCount(item.getResponse(), 2L);
|
||||
assertThat(item.getResponse().getMatches(), arrayWithSize(2));
|
||||
assertThat(item.getErrorMessage(), nullValue());
|
||||
assertThat(convertFromTextArray(item.getResponse().getMatches(), "test"), arrayContainingInAnyOrder("1", "4"));
|
||||
|
@ -183,18 +183,18 @@ public class MultiPercolatorIT extends ESIntegTestCase {
|
|||
item = response.getItems()[1];
|
||||
assertThat(item.getErrorMessage(), nullValue());
|
||||
|
||||
assertMatchCount(item.getResponse(), 2l);
|
||||
assertMatchCount(item.getResponse(), 2L);
|
||||
assertThat(item.getResponse().getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(item.getResponse().getMatches(), "test"), arrayContainingInAnyOrder("2", "4"));
|
||||
|
||||
item = response.getItems()[2];
|
||||
assertThat(item.getErrorMessage(), nullValue());
|
||||
assertMatchCount(item.getResponse(), 4l);
|
||||
assertMatchCount(item.getResponse(), 4L);
|
||||
assertThat(convertFromTextArray(item.getResponse().getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4"));
|
||||
|
||||
item = response.getItems()[3];
|
||||
assertThat(item.getErrorMessage(), nullValue());
|
||||
assertMatchCount(item.getResponse(), 1l);
|
||||
assertMatchCount(item.getResponse(), 1L);
|
||||
assertThat(item.getResponse().getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(item.getResponse().getMatches(), "test"), arrayContaining("4"));
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setPercolateDoc(docBuilder().setDoc(jsonBuilder().startObject().field("field1", "b").endObject()))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "4"));
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setPercolateDoc(docBuilder().setDoc(yamlBuilder().startObject().field("field1", "c").endObject()))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("2", "4"));
|
||||
|
||||
|
@ -153,7 +153,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setPercolateDoc(docBuilder().setDoc(smileBuilder().startObject().field("field1", "b c").endObject()))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 4l);
|
||||
assertMatchCount(response, 4L);
|
||||
assertThat(response.getMatches(), arrayWithSize(4));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4"));
|
||||
|
||||
|
@ -162,7 +162,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setPercolateDoc(docBuilder().setDoc(jsonBuilder().startObject().field("field1", "d").endObject()))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContaining("4"));
|
||||
|
||||
|
@ -190,7 +190,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
PercolateResponse response = client().preparePercolate().setSource(doc)
|
||||
.setIndices("test").setDocumentType("type1")
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 0l);
|
||||
assertMatchCount(response, 0L);
|
||||
assertThat(response.getMatches(), emptyArray());
|
||||
|
||||
// add first query...
|
||||
|
@ -202,7 +202,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
response = client().preparePercolate()
|
||||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(doc).execute().actionGet();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContaining("test1"));
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(doc)
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("test1", "test2"));
|
||||
|
||||
|
@ -226,7 +226,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
response = client().preparePercolate()
|
||||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(doc).execute().actionGet();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContaining("test1"));
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateDoc(docBuilder().setDoc(jsonBuilder().startObject().startObject("doc").field("field1", "value").endObject().endObject()))
|
||||
.setSize(100)
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 100l);
|
||||
assertMatchCount(response, 100L);
|
||||
assertThat(response.getMatches(), arrayWithSize(100));
|
||||
|
||||
logger.info("--> Percolate doc with routing=0");
|
||||
|
@ -262,7 +262,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setSize(100)
|
||||
.setRouting("0")
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 50l);
|
||||
assertMatchCount(response, 50L);
|
||||
assertThat(response.getMatches(), arrayWithSize(50));
|
||||
|
||||
logger.info("--> Percolate doc with routing=1");
|
||||
|
@ -272,7 +272,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setSize(100)
|
||||
.setRouting("1")
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 50l);
|
||||
assertMatchCount(response, 50L);
|
||||
assertThat(response.getMatches(), arrayWithSize(50));
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.field("query", termQuery("source", "productizer"))
|
||||
.endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
SearchResponse countResponse = client().prepareSearch().setSize(0)
|
||||
.setQuery(matchAllQuery()).setTypes(PercolatorService.TYPE_NAME)
|
||||
.execute().actionGet();
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1l));
|
||||
assertThat(countResponse.getHits().totalHits(), equalTo(1L));
|
||||
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
@ -369,7 +369,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value1").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPreference("_local")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value1").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
countResponse = client().prepareSearch().setSize(0)
|
||||
.setQuery(matchAllQuery()).setTypes(PercolatorService.TYPE_NAME)
|
||||
.execute().actionGet();
|
||||
assertHitCount(countResponse, 0l);
|
||||
assertHitCount(countResponse, 0L);
|
||||
}
|
||||
|
||||
public void testMultiplePercolators() throws Exception {
|
||||
|
@ -419,7 +419,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value1").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(percolate.getMatches(), "test"), arrayContaining("kuku"));
|
||||
|
||||
|
@ -427,7 +427,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value2").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(percolate.getMatches(), "test"), arrayContaining("bubu"));
|
||||
|
||||
|
@ -453,7 +453,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value1").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(percolate.getMatches(), "test"), arrayContaining("kuku"));
|
||||
|
||||
|
@ -470,7 +470,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value2").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(percolate.getMatches(), "test"), arrayContaining("bubu"));
|
||||
|
||||
|
@ -490,7 +490,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(sourceBuilder)
|
||||
.execute().actionGet();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(percolate.getMatches(), "test"), arrayContaining("susu"));
|
||||
|
||||
|
@ -503,7 +503,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.field("field1", "value1")
|
||||
.endObject().endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(percolate, 0l);
|
||||
assertMatchCount(percolate, 0L);
|
||||
assertThat(percolate.getMatches(), emptyArray());
|
||||
}
|
||||
|
||||
|
@ -522,16 +522,16 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field", "val").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContaining("1"));
|
||||
|
||||
NumShards numShards = getNumShards("test");
|
||||
|
||||
IndicesStatsResponse indicesResponse = client().admin().indices().prepareStats("test").execute().actionGet();
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getCount(), equalTo((long) numShards.numPrimaries));
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getCurrent(), equalTo(0l));
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getCurrent(), equalTo(0L));
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getNumQueries(), equalTo((long)numShards.dataCopies)); //number of copies
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getMemorySizeInBytes(), equalTo(-1l));
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getMemorySizeInBytes(), equalTo(-1L));
|
||||
|
||||
NodesStatsResponse nodesResponse = client().admin().cluster().prepareNodesStats().execute().actionGet();
|
||||
long percolateCount = 0;
|
||||
|
@ -545,15 +545,15 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field", "val").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContaining("1"));
|
||||
|
||||
indicesResponse = client().admin().indices().prepareStats().setPercolate(true).execute().actionGet();
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getCount(), equalTo((long) numShards.numPrimaries * 2));
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getCurrent(), equalTo(0l));
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getCurrent(), equalTo(0L));
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getNumQueries(), equalTo((long)numShards.dataCopies)); //number of copies
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getMemorySizeInBytes(), equalTo(-1l));
|
||||
assertThat(indicesResponse.getTotal().getPercolate().getMemorySizeInBytes(), equalTo(-1L));
|
||||
|
||||
percolateCount = 0;
|
||||
nodesResponse = client().admin().cluster().prepareNodesStats().execute().actionGet();
|
||||
|
@ -588,7 +588,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
percolateCount += nodeStats.getIndices().getPercolate().getCount();
|
||||
percolateSumTime += nodeStats.getIndices().getPercolate().getTimeInMillis();
|
||||
}
|
||||
assertThat(percolateSumTime, greaterThan(0l));
|
||||
assertThat(percolateSumTime, greaterThan(0L));
|
||||
}
|
||||
|
||||
public void testPercolatingExistingDocs() throws Exception {
|
||||
|
@ -624,7 +624,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("1"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "4"));
|
||||
|
||||
|
@ -633,7 +633,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("2"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("2", "4"));
|
||||
|
||||
|
@ -642,7 +642,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("3"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 4l);
|
||||
assertMatchCount(response, 4L);
|
||||
assertThat(response.getMatches(), arrayWithSize(4));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4"));
|
||||
|
||||
|
@ -651,7 +651,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("4"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContaining("4"));
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("1").routing("4"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "4"));
|
||||
|
||||
|
@ -698,7 +698,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("2").routing("3"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("2", "4"));
|
||||
|
||||
|
@ -707,7 +707,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("3").routing("2"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 4l);
|
||||
assertMatchCount(response, 4L);
|
||||
assertThat(response.getMatches(), arrayWithSize(4));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4"));
|
||||
|
||||
|
@ -716,7 +716,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("4").routing("1"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContaining("4"));
|
||||
}
|
||||
|
@ -752,9 +752,9 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
logger.info("--> Percolate existing doc with id 2 and version 1");
|
||||
PercolateResponse response = client().preparePercolate()
|
||||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("2").version(1l))
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("2").version(1L))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("2", "4"));
|
||||
|
||||
|
@ -762,7 +762,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
try {
|
||||
client().preparePercolate()
|
||||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("2").version(2l))
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("2").version(2L))
|
||||
.execute().actionGet();
|
||||
fail("Error should have been thrown");
|
||||
} catch (VersionConflictEngineException e) {
|
||||
|
@ -774,9 +774,9 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
logger.info("--> Percolate existing doc with id 2 and version 2");
|
||||
response = client().preparePercolate()
|
||||
.setIndices("test").setDocumentType("type")
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("2").version(2l))
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("2").version(2L))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("2", "4"));
|
||||
}
|
||||
|
@ -799,7 +799,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test1").setDocumentType("type")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 5l);
|
||||
assertMatchCount(response, 5L);
|
||||
assertThat(response.getMatches(), arrayWithSize(5));
|
||||
|
||||
logger.info("--> Percolate doc to index test2");
|
||||
|
@ -807,7 +807,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test2").setDocumentType("type")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 5l);
|
||||
assertMatchCount(response, 5L);
|
||||
assertThat(response.getMatches(), arrayWithSize(5));
|
||||
|
||||
logger.info("--> Percolate doc to index test1 and test2");
|
||||
|
@ -815,7 +815,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test1", "test2").setDocumentType("type")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 10l);
|
||||
assertMatchCount(response, 10L);
|
||||
assertThat(response.getMatches(), arrayWithSize(10));
|
||||
|
||||
logger.info("--> Percolate doc to index test2 and test3, with ignore missing");
|
||||
|
@ -824,7 +824,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndicesOptions(IndicesOptions.lenientExpandOpen())
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 5l);
|
||||
assertMatchCount(response, 5L);
|
||||
assertThat(response.getMatches(), arrayWithSize(5));
|
||||
|
||||
logger.info("--> Adding aliases");
|
||||
|
@ -841,7 +841,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("my-alias1").setDocumentType("type")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 10l);
|
||||
assertMatchCount(response, 10L);
|
||||
assertThat(response.getMatches(), arrayWithSize(10));
|
||||
for (PercolateResponse.Match match : response) {
|
||||
assertThat(match.getIndex().string(), anyOf(equalTo("test1"), equalTo("test2")));
|
||||
|
@ -852,7 +852,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("my-alias2").setDocumentType("type")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", "value").endObject().endObject())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 5l);
|
||||
assertMatchCount(response, 5L);
|
||||
assertThat(response.getMatches(), arrayWithSize(5));
|
||||
for (PercolateResponse.Match match : response) {
|
||||
assertThat(match.getIndex().string(), equalTo("test2"));
|
||||
|
@ -883,7 +883,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateDoc(new PercolateSourceBuilder.DocBuilder().setDoc("{}"))
|
||||
.get();
|
||||
assertNoFailures(response);
|
||||
assertThat(response.getCount(), equalTo(1l));
|
||||
assertThat(response.getCount(), equalTo(1L));
|
||||
assertThat(response.getMatches()[0].getId().string(), equalTo("1"));
|
||||
|
||||
response = client().preparePercolate()
|
||||
|
@ -892,7 +892,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateDoc(new PercolateSourceBuilder.DocBuilder().setDoc("{}"))
|
||||
.get();
|
||||
assertNoFailures(response);
|
||||
assertThat(response.getCount(), equalTo(1l));
|
||||
assertThat(response.getCount(), equalTo(1L));
|
||||
assertThat(response.getMatches()[0].getId().string(), equalTo("2"));
|
||||
|
||||
|
||||
|
@ -902,7 +902,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateDoc(new PercolateSourceBuilder.DocBuilder().setDoc("{}"))
|
||||
.get();
|
||||
assertNoFailures(response);
|
||||
assertThat(response.getCount(), equalTo(0l));
|
||||
assertThat(response.getCount(), equalTo(0L));
|
||||
|
||||
// Testing that the alias filter and the filter specified while percolating are both taken into account.
|
||||
response = client().preparePercolate()
|
||||
|
@ -912,7 +912,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateQuery(QueryBuilders.matchAllQuery())
|
||||
.get();
|
||||
assertNoFailures(response);
|
||||
assertThat(response.getCount(), equalTo(1l));
|
||||
assertThat(response.getCount(), equalTo(1L));
|
||||
assertThat(response.getMatches()[0].getId().string(), equalTo("1"));
|
||||
|
||||
response = client().preparePercolate()
|
||||
|
@ -922,7 +922,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateQuery(QueryBuilders.matchAllQuery())
|
||||
.get();
|
||||
assertNoFailures(response);
|
||||
assertThat(response.getCount(), equalTo(1l));
|
||||
assertThat(response.getCount(), equalTo(1L));
|
||||
assertThat(response.getMatches()[0].getId().string(), equalTo("2"));
|
||||
|
||||
|
||||
|
@ -933,7 +933,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateQuery(QueryBuilders.matchAllQuery())
|
||||
.get();
|
||||
assertNoFailures(response);
|
||||
assertThat(response.getCount(), equalTo(0l));
|
||||
assertThat(response.getCount(), equalTo(0L));
|
||||
}
|
||||
|
||||
public void testCountPercolation() throws Exception {
|
||||
|
@ -966,7 +966,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type").setOnlyCount(true)
|
||||
.setPercolateDoc(docBuilder().setDoc(jsonBuilder().startObject().field("field1", "b").endObject()))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), nullValue());
|
||||
|
||||
logger.info("--> Count percolate doc with field1=c");
|
||||
|
@ -974,7 +974,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type").setOnlyCount(true)
|
||||
.setPercolateDoc(docBuilder().setDoc(yamlBuilder().startObject().field("field1", "c").endObject()))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), nullValue());
|
||||
|
||||
logger.info("--> Count percolate doc with field1=b c");
|
||||
|
@ -982,7 +982,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type").setOnlyCount(true)
|
||||
.setPercolateDoc(docBuilder().setDoc(smileBuilder().startObject().field("field1", "b c").endObject()))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 4l);
|
||||
assertMatchCount(response, 4L);
|
||||
assertThat(response.getMatches(), nullValue());
|
||||
|
||||
logger.info("--> Count percolate doc with field1=d");
|
||||
|
@ -990,7 +990,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type").setOnlyCount(true)
|
||||
.setPercolateDoc(docBuilder().setDoc(jsonBuilder().startObject().field("field1", "d").endObject()))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), nullValue());
|
||||
|
||||
logger.info("--> Count percolate non existing doc");
|
||||
|
@ -1037,7 +1037,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type").setOnlyCount(true)
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("1"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), nullValue());
|
||||
|
||||
logger.info("--> Count percolate existing doc with id 2");
|
||||
|
@ -1045,7 +1045,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type").setOnlyCount(true)
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("2"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), nullValue());
|
||||
|
||||
logger.info("--> Count percolate existing doc with id 3");
|
||||
|
@ -1053,7 +1053,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type").setOnlyCount(true)
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("3"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 4l);
|
||||
assertMatchCount(response, 4L);
|
||||
assertThat(response.getMatches(), nullValue());
|
||||
|
||||
logger.info("--> Count percolate existing doc with id 4");
|
||||
|
@ -1061,7 +1061,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type").setOnlyCount(true)
|
||||
.setGetRequest(Requests.getRequest("test").type("type").id("4"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), nullValue());
|
||||
}
|
||||
|
||||
|
@ -1264,7 +1264,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateDoc(docBuilder().setDoc("field", "value"))
|
||||
.setPercolateQuery(QueryBuilders.functionScoreQuery(matchAllQuery(), fieldValueFactorFunction("level")))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches()[0].getId().string(), equalTo("2"));
|
||||
assertThat(response.getMatches()[0].getScore(), equalTo(2f));
|
||||
assertThat(response.getMatches()[1].getId().string(), equalTo("1"));
|
||||
|
@ -1308,7 +1308,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateDoc(docBuilder().setDoc("field", "value"))
|
||||
.setPercolateQuery(QueryBuilders.functionScoreQuery(matchAllQuery(), fieldValueFactorFunction("level")))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 0l);
|
||||
assertMatchCount(response, 0L);
|
||||
}
|
||||
|
||||
public void testPercolatorWithHighlighting() throws Exception {
|
||||
|
@ -1346,7 +1346,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateDoc(docBuilder().setDoc(jsonBuilder().startObject().field("field1", "The quick brown fox jumps over the lazy dog").endObject()))
|
||||
.setHighlightBuilder(new HighlightBuilder().field("field1"))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 5l);
|
||||
assertMatchCount(response, 5L);
|
||||
assertThat(response.getMatches(), arrayWithSize(5));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4", "5"));
|
||||
|
||||
|
@ -1372,7 +1372,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setHighlightBuilder(new HighlightBuilder().field("field1"))
|
||||
.setPercolateQuery(matchAllQuery())
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 5l);
|
||||
assertMatchCount(response, 5L);
|
||||
assertThat(response.getMatches(), arrayWithSize(5));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4", "5"));
|
||||
|
||||
|
@ -1431,7 +1431,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateQuery(functionScoreQuery(new WeightBuilder().setWeight(5.5f)))
|
||||
.setSortByScore(true)
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 5l);
|
||||
assertMatchCount(response, 5L);
|
||||
assertThat(response.getMatches(), arrayWithSize(5));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4", "5"));
|
||||
|
||||
|
@ -1463,7 +1463,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateQuery(functionScoreQuery(new WeightBuilder().setWeight(5.5f)))
|
||||
.setSortByScore(true)
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 5l);
|
||||
assertMatchCount(response, 5L);
|
||||
assertThat(response.getMatches(), arrayWithSize(5));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4", "5"));
|
||||
|
||||
|
@ -1501,7 +1501,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateQuery(functionScoreQuery(new WeightBuilder().setWeight(5.5f)))
|
||||
.setSortByScore(true)
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response, 5l);
|
||||
assertMatchCount(response, 5L);
|
||||
assertThat(response.getMatches(), arrayWithSize(5));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "2", "3", "4", "5"));
|
||||
|
||||
|
@ -1547,7 +1547,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.endObject())
|
||||
.execute().actionGet();
|
||||
assertNoFailures(percolate);
|
||||
assertMatchCount(percolate, 0l);
|
||||
assertMatchCount(percolate, 0L);
|
||||
}
|
||||
|
||||
public void testNestedPercolation() throws IOException {
|
||||
|
@ -1597,7 +1597,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setPercolateDoc(docBuilder().setDoc(jsonBuilder().startObject().field("field", "value").endObject()))
|
||||
.setPercolateQuery(QueryBuilders.matchAllQuery())
|
||||
.get();
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), arrayWithSize(1));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1"));
|
||||
}
|
||||
|
@ -1644,7 +1644,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("my-type")
|
||||
.setPercolateDoc(docBuilder().setDoc("timestamp", System.currentTimeMillis()))
|
||||
.get();
|
||||
assertMatchCount(response, 2l);
|
||||
assertMatchCount(response, 2L);
|
||||
assertThat(response.getMatches(), arrayWithSize(2));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("1", "2"));
|
||||
}
|
||||
|
@ -1799,7 +1799,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("doc")
|
||||
.setPercolateDoc(docBuilder().setDoc(doc))
|
||||
.get();
|
||||
assertMatchCount(response, 3l);
|
||||
assertMatchCount(response, 3L);
|
||||
Set<String> expectedIds = new HashSet<>();
|
||||
expectedIds.add("q1");
|
||||
expectedIds.add("q4");
|
||||
|
@ -1812,12 +1812,12 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("doc")
|
||||
.setPercolateDoc(docBuilder().setDoc(doc))
|
||||
.get();
|
||||
assertMatchCount(response, 3l);
|
||||
assertMatchCount(response, 3L);
|
||||
response = client().preparePercolate().setScore(randomBoolean()).setSortByScore(randomBoolean()).setOnlyCount(randomBoolean()).setSize(10).setPercolateQuery(QueryBuilders.termQuery("text", "foo"))
|
||||
.setIndices("test").setDocumentType("doc")
|
||||
.setPercolateDoc(docBuilder().setDoc(doc))
|
||||
.get();
|
||||
assertMatchCount(response, 3l);
|
||||
assertMatchCount(response, 3L);
|
||||
}
|
||||
|
||||
public void testMapUnmappedFieldAsString() throws IOException{
|
||||
|
@ -1835,7 +1835,7 @@ public class PercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type")
|
||||
.setPercolateDoc(docBuilder().setDoc(jsonBuilder().startObject().field("field1", "value").endObject()))
|
||||
.execute().actionGet();
|
||||
assertMatchCount(response1, 1l);
|
||||
assertMatchCount(response1, 1L);
|
||||
assertThat(response1.getMatches(), arrayWithSize(1));
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
.field("field1", "value1")
|
||||
.endObject().endObject())
|
||||
.get();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
.setRefresh(true)
|
||||
.get();
|
||||
|
||||
assertThat(client().prepareSearch().setSize(0).setTypes(PercolatorService.TYPE_NAME).setQuery(matchAllQuery()).get().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setSize(0).setTypes(PercolatorService.TYPE_NAME).setQuery(matchAllQuery()).get().getHits().totalHits(), equalTo(1L));
|
||||
|
||||
PercolateResponse percolate = client().preparePercolate()
|
||||
.setIndices("test").setDocumentType("type1")
|
||||
|
@ -124,7 +124,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
.field("field1", "value1")
|
||||
.endObject().endObject())
|
||||
.get();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
|
||||
internalCluster().rollingRestart();
|
||||
|
@ -134,7 +134,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
logger.info("Done Cluster Health, status " + clusterHealth.getStatus());
|
||||
assertThat(clusterHealth.isTimedOut(), equalTo(false));
|
||||
SearchResponse countResponse = client().prepareSearch().setSize(0).setTypes(PercolatorService.TYPE_NAME).setQuery(matchAllQuery()).get();
|
||||
assertHitCount(countResponse, 1l);
|
||||
assertHitCount(countResponse, 1L);
|
||||
|
||||
DeleteIndexResponse actionGet = client().admin().indices().prepareDelete("test").get();
|
||||
assertThat(actionGet.isAcknowledged(), equalTo(true));
|
||||
|
@ -142,7 +142,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
clusterHealth = client().admin().cluster().health(clusterHealthRequest().waitForYellowStatus().waitForActiveShards(1)).actionGet();
|
||||
logger.info("Done Cluster Health, status " + clusterHealth.getStatus());
|
||||
assertThat(clusterHealth.isTimedOut(), equalTo(false));
|
||||
assertThat(client().prepareSearch().setSize(0).setTypes(PercolatorService.TYPE_NAME).setQuery(matchAllQuery()).get().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch().setSize(0).setTypes(PercolatorService.TYPE_NAME).setQuery(matchAllQuery()).get().getHits().totalHits(), equalTo(0L));
|
||||
|
||||
percolate = client().preparePercolate()
|
||||
.setIndices("test").setDocumentType("type1")
|
||||
|
@ -150,7 +150,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
.field("field1", "value1")
|
||||
.endObject().endObject())
|
||||
.get();
|
||||
assertMatchCount(percolate, 0l);
|
||||
assertMatchCount(percolate, 0L);
|
||||
assertThat(percolate.getMatches(), emptyArray());
|
||||
|
||||
logger.info("--> register a query");
|
||||
|
@ -162,7 +162,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
.setRefresh(true)
|
||||
.get();
|
||||
|
||||
assertThat(client().prepareSearch().setSize(0).setTypes(PercolatorService.TYPE_NAME).setQuery(matchAllQuery()).get().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setSize(0).setTypes(PercolatorService.TYPE_NAME).setQuery(matchAllQuery()).get().getHits().totalHits(), equalTo(1L));
|
||||
|
||||
percolate = client().preparePercolate()
|
||||
.setIndices("test").setDocumentType("type1")
|
||||
|
@ -170,7 +170,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
.field("field1", "value1")
|
||||
.endObject().endObject())
|
||||
.get();
|
||||
assertMatchCount(percolate, 1l);
|
||||
assertMatchCount(percolate, 1L);
|
||||
assertThat(percolate.getMatches(), arrayWithSize(1));
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", 95).endObject().endObject())
|
||||
.get();
|
||||
assertMatchCount(response, 6l);
|
||||
assertMatchCount(response, 6L);
|
||||
assertThat(response.getMatches(), arrayWithSize(6));
|
||||
assertThat(convertFromTextArray(response.getMatches(), "test"), arrayContainingInAnyOrder("95", "96", "97", "98", "99", "100"));
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class RecoveryPercolatorIT extends ESIntegTestCase {
|
|||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(jsonBuilder().startObject().startObject("doc").field("field1", 100).endObject().endObject()).get();
|
||||
|
||||
assertMatchCount(response, 1l);
|
||||
assertMatchCount(response, 1L);
|
||||
assertThat(response.getMatches(), arrayWithSize(1));
|
||||
assertThat(response.getMatches()[0].getId().string(), equalTo("100"));
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ public class TTLPercolatorIT extends ESIntegTestCase {
|
|||
.endObject()
|
||||
.endObject()
|
||||
).execute().actionGet();
|
||||
assertMatchCount(percolateResponse, 0l);
|
||||
assertMatchCount(percolateResponse, 0L);
|
||||
assertThat(percolateResponse.getMatches(), emptyArray());
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class FullRollingRestartIT extends ESIntegTestCase {
|
|||
logger.info("--> refreshing and checking data");
|
||||
refresh();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2000l);
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2000L);
|
||||
}
|
||||
|
||||
// now start shutting nodes down
|
||||
|
@ -109,7 +109,7 @@ public class FullRollingRestartIT extends ESIntegTestCase {
|
|||
logger.info("--> stopped two nodes, verifying data");
|
||||
refresh();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2000l);
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2000L);
|
||||
}
|
||||
|
||||
// closing the 3rd node
|
||||
|
@ -127,7 +127,7 @@ public class FullRollingRestartIT extends ESIntegTestCase {
|
|||
logger.info("--> one node left, verifying data");
|
||||
refresh();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2000l);
|
||||
assertHitCount(client().prepareSearch().setSize(0).setQuery(matchAllQuery()).get(), 2000L);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ public class RelocationIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> verifying count");
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client().prepareSearch("test").setSize(0).execute().actionGet().getHits().totalHits(), equalTo(20l));
|
||||
assertThat(client().prepareSearch("test").setSize(0).execute().actionGet().getHits().totalHits(), equalTo(20L));
|
||||
|
||||
logger.info("--> start another node");
|
||||
final String node_2 = internalCluster().startNode();
|
||||
|
@ -140,7 +140,7 @@ public class RelocationIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> verifying count again...");
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
assertThat(client().prepareSearch("test").setSize(0).execute().actionGet().getHits().totalHits(), equalTo(20l));
|
||||
assertThat(client().prepareSearch("test").setSize(0).execute().actionGet().getHits().totalHits(), equalTo(20L));
|
||||
}
|
||||
|
||||
public void testRelocationWhileIndexingRandom() throws Exception {
|
||||
|
|
|
@ -54,7 +54,7 @@ public class AliasResolveRoutingIT extends ESIntegTestCase {
|
|||
client().prepareIndex("test-0", "type1", "2").setSource("field1", "quick brown"),
|
||||
client().prepareIndex("test-0", "type1", "3").setSource("field1", "quick"));
|
||||
refresh("test-*");
|
||||
assertHitCount(client().prepareSearch().setIndices("alias-*").setIndicesOptions(IndicesOptions.lenientExpandOpen()).setQuery(matchQuery("_all", "quick")).get(), 3l);
|
||||
assertHitCount(client().prepareSearch().setIndices("alias-*").setIndicesOptions(IndicesOptions.lenientExpandOpen()).setQuery(matchQuery("_all", "quick")).get(), 3L);
|
||||
}
|
||||
|
||||
public void testResolveIndexRouting() throws Exception {
|
||||
|
|
|
@ -122,23 +122,23 @@ public class AliasRoutingIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> search with no routing, should fine one");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
logger.info("--> search with wrong routing, should not find");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch("alias1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch("alias1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch().setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
assertThat(client().prepareSearch("alias1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
assertThat(client().prepareSearch("alias1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
}
|
||||
|
||||
logger.info("--> search with correct routing, should find");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch("alias0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch("alias0").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch("alias0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch("alias0").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
logger.info("--> indexing with id [2], and routing [1] using alias");
|
||||
|
@ -146,50 +146,50 @@ public class AliasRoutingIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> search with no routing, should fine two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
|
||||
logger.info("--> search with 0 routing, should find one");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch("alias0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch("alias0").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch("alias0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch("alias0").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
logger.info("--> search with 1 routing, should find one");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch("alias1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch("alias1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch("alias1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch("alias1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
logger.info("--> search with 0,1 routings , should find two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("0", "1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0", "1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias01").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias01").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setRouting("0", "1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0", "1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch("alias01").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch("alias01").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
|
||||
logger.info("--> search with two routing aliases , should find two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch("alias0", "alias1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias0", "alias1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias0", "alias1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch("alias0", "alias1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
|
||||
logger.info("--> search with alias0, alias1 and alias01, should find two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch("alias0", "alias1", "alias01").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias0", "alias1", "alias01").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias0", "alias1", "alias01").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch("alias0", "alias1", "alias01").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
|
||||
logger.info("--> search with test, alias0 and alias1, should find two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch("test", "alias0", "alias1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("test", "alias0", "alias1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("test", "alias0", "alias1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch("test", "alias0", "alias1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -231,20 +231,20 @@ public class AliasRoutingIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> search with alias-a1,alias-b0, should not find");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch("alias-a1", "alias-b0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch("alias-a1", "alias-b0").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch("alias-a1", "alias-b0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
assertThat(client().prepareSearch("alias-a1", "alias-b0").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
}
|
||||
|
||||
logger.info("--> search with alias-ab, should find two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch("alias-ab").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias-ab").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias-ab").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch("alias-ab").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
|
||||
logger.info("--> search with alias-a0,alias-b1 should find two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch("alias-a0", "alias-b1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias-a0", "alias-b1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias-a0", "alias-b1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch("alias-a0", "alias-b1").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ public class AliasRoutingIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> search all on index_* should find two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch("index_*").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("index_*").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,8 +313,8 @@ public class AliasRoutingIT extends ESIntegTestCase {
|
|||
logger.info("--> verifying get and search with routing, should find");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareGet("test", "type1", "0").setRouting("3").execute().actionGet().isExists(), equalTo(true));
|
||||
assertThat(client().prepareSearch("alias").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch("alias").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch("alias").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch("alias").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
logger.info("--> creating alias with routing [4]");
|
||||
|
@ -323,8 +323,8 @@ public class AliasRoutingIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> verifying search with wrong routing should not find");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch("alias").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch("alias").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch("alias").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
assertThat(client().prepareSearch("alias").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
}
|
||||
|
||||
logger.info("--> creating alias with search routing [3,4] and index routing 4");
|
||||
|
@ -339,8 +339,8 @@ public class AliasRoutingIT extends ESIntegTestCase {
|
|||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareGet("test", "type1", "0").setRouting("3").execute().actionGet().isExists(), equalTo(true));
|
||||
assertThat(client().prepareGet("test", "type1", "1").setRouting("4").execute().actionGet().isExists(), equalTo(true));
|
||||
assertThat(client().prepareSearch("alias").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch("alias").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch("alias").setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -107,19 +107,19 @@ public class SimpleRoutingIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> search with no routing, should fine one");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
logger.info("--> search with wrong routing, should not find");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0l));
|
||||
assertThat(client().prepareSearch().setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(0L));
|
||||
}
|
||||
|
||||
logger.info("--> search with correct routing, should find");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
logger.info("--> indexing with id [2], and routing [1]");
|
||||
|
@ -127,32 +127,32 @@ public class SimpleRoutingIT extends ESIntegTestCase {
|
|||
|
||||
logger.info("--> search with no routing, should fine two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
|
||||
logger.info("--> search with 0 routing, should find one");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
logger.info("--> search with 1 routing, should find one");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1l));
|
||||
assertThat(client().prepareSearch().setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(1L));
|
||||
}
|
||||
|
||||
logger.info("--> search with 0,1 routings , should find two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("0", "1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0", "1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setRouting("0", "1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0", "1").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
|
||||
logger.info("--> search with 0,1,0 routings , should find two");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertThat(client().prepareSearch().setRouting("0", "1", "0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0", "1", "0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2l));
|
||||
assertThat(client().prepareSearch().setRouting("0", "1", "0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
assertThat(client().prepareSearch().setSize(0).setRouting("0", "1", "0").setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().getHits().totalHits(), equalTo(2L));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ public class SimpleRoutingIT extends ESIntegTestCase {
|
|||
UpdateResponse updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1").setRouting("0")
|
||||
.setDoc("field1", "value1").get();
|
||||
assertThat(updateResponse.getId(), equalTo("1"));
|
||||
assertThat(updateResponse.getVersion(), equalTo(2l));
|
||||
assertThat(updateResponse.getVersion(), equalTo(2L));
|
||||
|
||||
try {
|
||||
client().prepareUpdate(indexOrAlias(), "type1", "1").setDoc("field1", "value1").get();
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ScriptFieldIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
static int[] intArray = { Integer.MAX_VALUE, Integer.MIN_VALUE, 3 };
|
||||
static long[] longArray = { Long.MAX_VALUE, Long.MIN_VALUE, 9223372036854775807l };
|
||||
static long[] longArray = { Long.MAX_VALUE, Long.MIN_VALUE, 9223372036854775807L };
|
||||
static float[] floatArray = { Float.MAX_VALUE, Float.MIN_VALUE, 3.3f };
|
||||
static double[] doubleArray = { Double.MAX_VALUE, Double.MIN_VALUE, 3.3d };
|
||||
|
||||
|
|
|
@ -891,7 +891,7 @@ public class ScriptParameterParserTests extends ESTestCase {
|
|||
|
||||
public void testConfigMultipleParametersInlineWrongType() throws IOException {
|
||||
Map<String, Object> config = new HashMap<>();
|
||||
config.put("foo", 1l);
|
||||
config.put("foo", 1L);
|
||||
config.put("bar_file", "barScriptValue");
|
||||
config.put("baz_id", "bazScriptValue");
|
||||
config.put("lang", "myLang");
|
||||
|
@ -917,7 +917,7 @@ public class ScriptParameterParserTests extends ESTestCase {
|
|||
public void testConfigMultipleParametersFileWrongType() throws IOException {
|
||||
Map<String, Object> config = new HashMap<>();
|
||||
config.put("foo", "fooScriptValue");
|
||||
config.put("bar_file", 1l);
|
||||
config.put("bar_file", 1L);
|
||||
config.put("baz_id", "bazScriptValue");
|
||||
config.put("lang", "myLang");
|
||||
Set<String> parameters = new HashSet<>();
|
||||
|
@ -944,7 +944,7 @@ public class ScriptParameterParserTests extends ESTestCase {
|
|||
Map<String, Object> config = new HashMap<>();
|
||||
config.put("foo", "fooScriptValue");
|
||||
config.put("bar_file", "barScriptValue");
|
||||
config.put("baz_id", 1l);
|
||||
config.put("baz_id", 1L);
|
||||
config.put("lang", "myLang");
|
||||
Set<String> parameters = new HashSet<>();
|
||||
parameters.add("foo");
|
||||
|
@ -970,7 +970,7 @@ public class ScriptParameterParserTests extends ESTestCase {
|
|||
config.put("foo", "fooScriptValue");
|
||||
config.put("bar_file", "barScriptValue");
|
||||
config.put("baz_id", "bazScriptValue");
|
||||
config.put("lang", 1l);
|
||||
config.put("lang", 1L);
|
||||
Set<String> parameters = new HashSet<>();
|
||||
parameters.add("foo");
|
||||
parameters.add("bar");
|
||||
|
|
|
@ -50,7 +50,7 @@ public class SearchWithRejectionsIT extends ESIntegTestCase {
|
|||
client().prepareIndex("test", "type", Integer.toString(i)).setSource("field", "value").execute().actionGet();
|
||||
}
|
||||
IndicesStatsResponse indicesStats = client().admin().indices().prepareStats().execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getSearch().getOpenContexts(), equalTo(0l));
|
||||
assertThat(indicesStats.getTotal().getSearch().getOpenContexts(), equalTo(0L));
|
||||
refresh();
|
||||
|
||||
int numSearches = 10;
|
||||
|
@ -71,6 +71,6 @@ public class SearchWithRejectionsIT extends ESIntegTestCase {
|
|||
}
|
||||
awaitBusy(() -> client().admin().indices().prepareStats().execute().actionGet().getTotal().getSearch().getOpenContexts() == 0, 1, TimeUnit.SECONDS);
|
||||
indicesStats = client().admin().indices().prepareStats().execute().actionGet();
|
||||
assertThat(indicesStats.getTotal().getSearch().getOpenContexts(), equalTo(0l));
|
||||
assertThat(indicesStats.getTotal().getSearch().getOpenContexts(), equalTo(0L));
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue