public static GetMappingsResponse fromXContent(XContentParser parser) throws IOException { if (parser.currentToken() == null) { parser.nextToken(); } assert parser.currentToken() == XContentParser.Token.START_OBJECT; Map<String, Object> parts = parser.map(); ImmutableOpenMap.Builder<String, ImmutableOpenMap<String, MappingMetaData>> builder = new ImmutableOpenMap.Builder<>(); for (Map.Entry<String, Object> entry : parts.entrySet()) { final String indexName = entry.getKey(); assert entry.getValue() instanceof Map : "expected a map as type mapping, but got: " + entry.getValue().getClass(); final Map<String, Object> mapping = (Map<String, Object>) ((Map) entry.getValue()).get(MAPPINGS.getPreferredName()); ImmutableOpenMap.Builder<String, MappingMetaData> typeBuilder = new ImmutableOpenMap.Builder<>(); for (Map.Entry<String, Object> typeEntry : mapping.entrySet()) { final String typeName = typeEntry.getKey(); assert typeEntry.getValue() instanceof Map : "expected a map as inner type mapping, but got: " + typeEntry.getValue().getClass(); final Map<String, Object> fieldMappings = (Map<String, Object>) typeEntry.getValue(); MappingMetaData mmd = new MappingMetaData(typeName, fieldMappings); typeBuilder.put(typeName, mmd); } builder.put(indexName, typeBuilder.build()); } return new GetMappingsResponse(builder.build()); }
public static RoutingTable build(ClusterService clusterService, ClusterState clusterState, Index index) { ImmutableOpenMap.Builder<String, IndexRoutingTable> indicesRoutingMap = new ImmutableOpenMap.Builder<>(); for(ObjectObjectCursor<String, IndexRoutingTable> entry : clusterState.routingTable().indicesRouting()) { if (!entry.key.equals(index)) indicesRoutingMap.put(entry.value.getIndex().getName(), entry.value); } // may update the routing table for the specified index IndexMetaData indexMetaData = clusterState.metaData().index(index); if (indexMetaData != null) { IndexRoutingTable.Builder indexRoutingTableBuilder = new IndexRoutingTable.Builder(index, clusterService, clusterState); if (indexRoutingTableBuilder.shards.size() > 0) indicesRoutingMap.put(index.getName(), indexRoutingTableBuilder.build()); } return new RoutingTable(clusterState.routingTable().version(), indicesRoutingMap.build()); }
public static <KType, VType> Builder<KType, VType> builder(int size) { return new Builder<>(size); }
public static <KType, VType> Builder<KType, VType> builder(ImmutableOpenMap<KType, VType> map) { return new Builder<>(map); }
public static <KType, VType> Builder<KType, VType> builder(int size) { return new Builder<>(size); }
public static <KType, VType> Builder<KType, VType> builder(ImmutableOpenMap<KType, VType> map) { return new Builder<>(map); }
public static <KType, VType> Builder<KType, VType> builder() { return new Builder<>(); }
public static <KType, VType> Builder<KType, VType> builder() { return new Builder<>(); }
public static <KType, VType> Builder<KType, VType> builder(ImmutableOpenMap<KType, VType> map) { return new Builder<>(map); }
private MultiFields(ContentPath.Type pathType, ImmutableOpenMap<String, FieldMapper> mappers) { this.pathType = pathType; ImmutableOpenMap.Builder<String, FieldMapper> builder = new ImmutableOpenMap.Builder<>(); // we disable the all in multi-field mappers for (ObjectObjectCursor<String, FieldMapper> cursor : mappers) { FieldMapper mapper = cursor.value; if (mapper instanceof AllFieldMapper.IncludeInAll) { mapper = (FieldMapper) ((AllFieldMapper.IncludeInAll) mapper).unsetIncludeInAll(); } builder.put(cursor.key, mapper); } this.mappers = builder.build(); }
public static <KType, VType> Builder<KType, VType> builder(int size) { return new Builder<>(size); }
public static <KType, VType> Builder<KType, VType> builder(int size) { return new Builder<>(size); }
private MultiFields(ImmutableOpenMap<String, FieldMapper> mappers) { ImmutableOpenMap.Builder<String, FieldMapper> builder = new ImmutableOpenMap.Builder<>(); // we disable the all in multi-field mappers for (ObjectObjectCursor<String, FieldMapper> cursor : mappers) { builder.put(cursor.key, cursor.value); } this.mappers = builder.build(); }
private MultiFields(ImmutableOpenMap<String, FieldMapper> mappers) { ImmutableOpenMap.Builder<String, FieldMapper> builder = new ImmutableOpenMap.Builder<>(); // we disable the all in multi-field mappers for (ObjectObjectCursor<String, FieldMapper> cursor : mappers) { builder.put(cursor.key, cursor.value); } this.mappers = builder.build(); }
private MultiFields(ImmutableOpenMap<String, FieldMapper> mappers) { ImmutableOpenMap.Builder<String, FieldMapper> builder = new ImmutableOpenMap.Builder<>(); // we disable the all in multi-field mappers for (ObjectObjectCursor<String, FieldMapper> cursor : mappers) { builder.put(cursor.key, cursor.value); } this.mappers = builder.build(); }
public static RoutingTable build(ClusterService clusterService, ClusterState clusterState) { ImmutableOpenMap.Builder<String, IndexRoutingTable> indicesRoutingMap = new ImmutableOpenMap.Builder<>(); for(ObjectObjectCursor<String, IndexMetaData> entry : clusterState.metaData().getIndices()) { IndexRoutingTable.Builder indexRoutingTableBuilder = new IndexRoutingTable.Builder(entry.value.getIndex(), clusterService, clusterState); if (indexRoutingTableBuilder.shards.size() > 0) indicesRoutingMap.put(indexRoutingTableBuilder.index.getName(), indexRoutingTableBuilder.build()); } return new RoutingTable(clusterState.routingTable().version(), indicesRoutingMap.build()); }
public static <KType, VType> Builder<KType, VType> builder() { return new Builder<>(); }
public static <KType, VType> Builder<KType, VType> builder(ImmutableOpenMap<KType, VType> map) { return new Builder<>(map); }
public static <KType, VType> Builder<KType, VType> builder(int size) { return new Builder<>(size); }
private MultiFields(ImmutableOpenMap<String, FieldMapper> mappers) { ImmutableOpenMap.Builder<String, FieldMapper> builder = new ImmutableOpenMap.Builder<>(); // we disable the all in multi-field mappers for (ObjectObjectCursor<String, FieldMapper> cursor : mappers) { builder.put(cursor.key, cursor.value); } this.mappers = builder.build(); }