public Index build() { return new Index(name, uuid); } }
public ShardId(String index, String indexUUID, int shardId) { this(new Index(index, indexUUID), shardId); }
public void setIndex(String index) { if (index != null) { setIndex(new Index(index, INDEX_UUID_NA_VALUE)); } }
private Tombstone(StreamInput in) throws IOException { index = new Index(in); deleteDateInMillis = in.readLong(); }
/** * Parse the string representation of this shardId back to an object. * We lose index uuid information here, but since we use toString in * rest responses, this is the best we can do to reconstruct the object * on the client side. */ public static ShardId fromString(String shardIdString) { int splitPosition = shardIdString.indexOf("]["); if (splitPosition <= 0 || shardIdString.charAt(0) != '[' || shardIdString.charAt(shardIdString.length() - 1) != ']') { throw new IllegalArgumentException("Unexpected shardId string format, expected [indexName][shardId] but got " + shardIdString); } String indexName = shardIdString.substring(1, splitPosition); int shardId = Integer.parseInt(shardIdString.substring(splitPosition + 2, shardIdString.length() - 1)); return new ShardId(new Index(indexName, IndexMetaData.INDEX_UUID_NA_VALUE), shardId); }
public static IndexShardRoutingTable readFrom(StreamInput in) throws IOException { Index index = new Index(in); return readFromThin(in, index); }
public Index getIndex() { List<String> index = getMetadata(INDEX_METADATA_KEY); if (index != null && index.isEmpty() == false) { List<String> index_uuid = getMetadata(INDEX_METADATA_KEY_UUID); return new Index(index.get(0), index_uuid.get(0)); } return null; }
@Override public void readFrom(StreamInput in) throws IOException { index = new Index(in); shardId = in.readVInt(); hashCode = computeHashCode(); }
@Override public void readFrom(StreamInput in) throws IOException { stats = new CommonStats(in); if (in.readBoolean()) { int entries = in.readVInt(); statsByShard = new HashMap<>(); for (int i = 0; i < entries; i++) { Index index = new Index(in); int indexShardListSize = in.readVInt(); List<IndexShardStats> indexShardStats = new ArrayList<>(indexShardListSize); for (int j = 0; j < indexShardListSize; j++) { indexShardStats.add(IndexShardStats.readIndexShardStats(in)); } statsByShard.put(index, indexShardStats); } } }
public Index getResizeSourceIndex() { return INDEX_RESIZE_SOURCE_UUID.exists(settings) || INDEX_SHRINK_SOURCE_UUID.exists(settings) ? new Index(INDEX_RESIZE_SOURCE_NAME.get(settings), INDEX_RESIZE_SOURCE_UUID.get(settings)) : null; }
public static IndexRoutingTable readFrom(StreamInput in) throws IOException { Index index = new Index(in); Builder builder = new Builder(index); int size = in.readVInt(); for (int i = 0; i < size; i++) { builder.addIndexShard(IndexShardRoutingTable.Builder.readFromThin(in, index)); } return builder.build(); }
if (nodeId != null) { searchShardTarget = new SearchShardTarget(nodeId, new ShardId(new Index(indexName, IndexMetaData.INDEX_UUID_NA_VALUE), shardId), clusterAlias, OriginalIndices.NONE);
if (_INDEX.equals(currentFieldName)) { context.setShardId(new ShardId(new Index(parser.text(), IndexMetaData.INDEX_UUID_NA_VALUE), -1)); } else if (_TYPE.equals(currentFieldName)) { context.setType(parser.text());
public QueryShardContext(int shardId, IndexSettings indexSettings, BitsetFilterCache bitsetFilterCache, BiFunction<MappedFieldType, String, IndexFieldData<?>> indexFieldDataLookup, MapperService mapperService, SimilarityService similarityService, ScriptService scriptService, NamedXContentRegistry xContentRegistry, NamedWriteableRegistry namedWriteableRegistry, Client client, IndexReader reader, LongSupplier nowInMillis, String clusterAlias) { super(xContentRegistry, namedWriteableRegistry,client, nowInMillis); this.shardId = shardId; this.similarityService = similarityService; this.mapperService = mapperService; this.bitsetFilterCache = bitsetFilterCache; this.indexFieldDataService = indexFieldDataLookup; this.allowUnmappedFields = indexSettings.isDefaultAllowUnmappedFields(); this.nestedScope = new NestedScope(); this.scriptService = scriptService; this.indexSettings = indexSettings; this.reader = reader; this.clusterAlias = clusterAlias; this.fullyQualifiedIndex = new Index(RemoteClusterAware.buildRemoteIndexName(clusterAlias, indexSettings.getIndex().getName()), indexSettings.getIndex().getUUID()); }
return new IndexMetaData(new Index(index, uuid), version, mappingVersion, settingsVersion, primaryTerms, state, numberOfShards, numberOfReplicas, tmpSettings, mappings.build(), tmpAliases.build(), customMetaData.build(), filledInSyncAllocationIds.build(), requireFilters, initialRecoveryFilters, includeFilters, excludeFilters,
public Index getIndex() { List<String> index = getMetadata(INDEX_METADATA_KEY); if (index != null && index.isEmpty() == false) { List<String> index_uuid = getMetadata(INDEX_METADATA_KEY_UUID); return new Index(index.get(0), index_uuid.get(0)); } return null; }
public void validateIndexSettings(String indexName, Settings settings) throws IndexCreationException { List<String> validationErrors = getIndexSettingsValidationErrors(settings); if (validationErrors.isEmpty() == false) { ValidationException validationException = new ValidationException(); validationException.addValidationErrors(validationErrors); throw new IndexCreationException(new Index(indexName), validationException); } }
public static IndexRoutingTable readFrom(StreamInput in) throws IOException { Index index = new Index(in); Builder builder = new Builder(index); int size = in.readVInt(); for (int i = 0; i < size; i++) { builder.addIndexShard(IndexShardRoutingTable.Builder.readFromThin(in, index)); } return builder.build(); }
public Index resolveIndex(String index) { GetIndexResponse getIndexResponse = client().admin().indices().prepareGetIndex().setIndices(index).get(); assertTrue("index " + index + " not found", getIndexResponse.getSettings().containsKey(index)); String uuid = getIndexResponse.getSettings().get(index).get(IndexMetaData.SETTING_INDEX_UUID); return new Index(index, uuid); }
@Test public void testDefaultsUkrainianAnalysis() { Settings settings = settingsBuilder() .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT) .put("path.home", createTempDir()) .build(); AnalysisService analysisService = provideWith(new Index("test"), settings); TokenFilterFactory tokenizerFactory = analysisService.tokenFilter("ukrainian_lemmatizer"); MatcherAssert.assertThat(tokenizerFactory, instanceOf(UkrainianLemmatizerTokenFilterFactory.class)); Analyzer analyzer = analysisService.analyzer("ukrainian").analyzer(); MatcherAssert.assertThat(analyzer, instanceOf(UkrainianAnalyzer.class)); }