Java Code Examples for org.elasticsearch.cluster.metadata.IndexMetaData#Custom

The following examples show how to use org.elasticsearch.cluster.metadata.IndexMetaData#Custom . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IndexWarmersMetaData.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public IndexMetaData.Custom mergeWith(IndexMetaData.Custom other) {
    IndexWarmersMetaData second = (IndexWarmersMetaData) other;
    List<Entry> entries = new ArrayList<>();
    entries.addAll(entries());
    for (Entry secondEntry : second.entries()) {
        boolean found = false;
        for (Entry firstEntry : entries()) {
            if (firstEntry.name().equals(secondEntry.name())) {
                found = true;
                break;
            }
        }
        if (!found) {
            entries.add(secondEntry);
        }
    }
    return new IndexWarmersMetaData(entries.toArray(new Entry[entries.size()]));
}
 
Example 2
Source File: CreateIndexRequest.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    cause = in.readString();
    index = in.readString();
    settings = readSettingsFromStream(in);
    readTimeout(in);
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        mappings.put(in.readString(), in.readString());
    }
    int customSize = in.readVInt();
    for (int i = 0; i < customSize; i++) {
        String type = in.readString();
        IndexMetaData.Custom customIndexMetaData = IndexMetaData.lookupPrototypeSafe(type).readFrom(in);
        customs.put(type, customIndexMetaData);
    }
    int aliasesSize = in.readVInt();
    for (int i = 0; i < aliasesSize; i++) {
        aliases.add(Alias.read(in));
    }
    updateAllTypes = in.readBoolean();
}
 
Example 3
Source File: PutIndexTemplateRequest.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    cause = in.readString();
    name = in.readString();
    template = in.readString();
    order = in.readInt();
    create = in.readBoolean();
    settings = readSettingsFromStream(in);
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        mappings.put(in.readString(), in.readString());
    }
    int customSize = in.readVInt();
    for (int i = 0; i < customSize; i++) {
        String type = in.readString();
        IndexMetaData.Custom customIndexMetaData = IndexMetaData.lookupPrototypeSafe(type).readFrom(in);
        customs.put(type, customIndexMetaData);
    }
    int aliasesSize = in.readVInt();
    for (int i = 0; i < aliasesSize; i++) {
        aliases.add(Alias.read(in));
    }
}
 
Example 4
Source File: CreateIndexRequest.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public Map<String, IndexMetaData.Custom> customs() {
    return this.customs;
}
 
Example 5
Source File: CreateIndexRequestBuilder.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
/**
 * Adds custom metadata to the index to be created.
 */
public CreateIndexRequestBuilder addCustom(IndexMetaData.Custom custom) {
    request.custom(custom);
    return this;
}
 
Example 6
Source File: CreateIndexClusterStateUpdateRequest.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public Map<String, IndexMetaData.Custom> customs() {
    return customs;
}
 
Example 7
Source File: PutIndexTemplateRequest.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public Map<String, IndexMetaData.Custom> customs() {
    return this.customs;
}