org.elasticsearch.common.xcontent.ObjectParser Java Examples

The following examples show how to use org.elasticsearch.common.xcontent.ObjectParser. 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: AbstractAllocateAllocationCommand.java    From crate with Apache License 2.0 5 votes vote down vote up
protected static <T extends Builder<?>> ObjectParser<T, Void> createAllocateParser(String command) {
    ObjectParser<T, Void> parser = new ObjectParser<>(command);
    parser.declareString(Builder::setIndex, new ParseField(INDEX_FIELD));
    parser.declareInt(Builder::setShard, new ParseField(SHARD_FIELD));
    parser.declareString(Builder::setNode, new ParseField(NODE_FIELD));
    return parser;
}
 
Example #2
Source File: BasePrimaryAllocationCommand.java    From crate with Apache License 2.0 4 votes vote down vote up
protected static <T extends Builder<?>> ObjectParser<T, Void> createAllocatePrimaryParser(String command) {
    ObjectParser<T, Void> parser = AbstractAllocateAllocationCommand.createAllocateParser(command);
    parser.declareBoolean(Builder::setAcceptDataLoss, new ParseField(ACCEPT_DATA_LOSS_FIELD));
    return parser;
}