• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RestBuilderListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.elasticsearch.rest.action.RestBuilderListener的典型用法代码示例。如果您正苦于以下问题:Java RestBuilderListener类的具体用法?Java RestBuilderListener怎么用?Java RestBuilderListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RestBuilderListener类属于org.elasticsearch.rest.action包,在下文中一共展示了RestBuilderListener类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    FlushRequest flushRequest = new FlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
    flushRequest.indicesOptions(IndicesOptions.fromRequest(request, flushRequest.indicesOptions()));
    flushRequest.force(request.paramAsBoolean("force", flushRequest.force()));
    flushRequest.waitIfOngoing(request.paramAsBoolean("wait_if_ongoing", flushRequest.waitIfOngoing()));
    return channel -> client.admin().indices().flush(flushRequest, new RestBuilderListener<FlushResponse>(channel) {
        @Override
        public RestResponse buildResponse(FlushResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:RestFlushAction.java


示例2: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    ForceMergeRequest mergeRequest = new ForceMergeRequest(Strings.splitStringByCommaToArray(request.param("index")));
    mergeRequest.indicesOptions(IndicesOptions.fromRequest(request, mergeRequest.indicesOptions()));
    mergeRequest.maxNumSegments(request.paramAsInt("max_num_segments", mergeRequest.maxNumSegments()));
    mergeRequest.onlyExpungeDeletes(request.paramAsBoolean("only_expunge_deletes", mergeRequest.onlyExpungeDeletes()));
    mergeRequest.flush(request.paramAsBoolean("flush", mergeRequest.flush()));
    return channel -> client.admin().indices().forceMerge(mergeRequest, new RestBuilderListener<ForceMergeResponse>(channel) {
        @Override
        public RestResponse buildResponse(ForceMergeResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:RestForceMergeAction.java


示例3: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {

    final RecoveryRequest recoveryRequest = new RecoveryRequest(Strings.splitStringByCommaToArray(request.param("index")));
    recoveryRequest.detailed(request.paramAsBoolean("detailed", false));
    recoveryRequest.activeOnly(request.paramAsBoolean("active_only", false));
    recoveryRequest.indicesOptions(IndicesOptions.fromRequest(request, recoveryRequest.indicesOptions()));

    return channel -> client.admin().indices().recoveries(recoveryRequest, new RestBuilderListener<RecoveryResponse>(channel) {
        @Override
        public RestResponse buildResponse(RecoveryResponse response, XContentBuilder builder) throws Exception {
            response.detailed(recoveryRequest.detailed());
            builder.startObject();
            response.toXContent(builder, request);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:RestRecoveryAction.java


示例4: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(
            Strings.splitStringByCommaToArray(request.param("index")));
    clearIndicesCacheRequest.indicesOptions(IndicesOptions.fromRequest(request, clearIndicesCacheRequest.indicesOptions()));
    fromRequest(request, clearIndicesCacheRequest);
    return channel ->
            client.admin().indices().clearCache(clearIndicesCacheRequest, new RestBuilderListener<ClearIndicesCacheResponse>(channel) {
        @Override
        public RestResponse buildResponse(ClearIndicesCacheResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:RestClearIndicesCacheAction.java


示例5: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(
            Strings.splitStringByCommaToArray(request.param("index")));
    indicesSegmentsRequest.verbose(request.paramAsBoolean("verbose", false));
    indicesSegmentsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesSegmentsRequest.indicesOptions()));
    return channel ->
        client.admin().indices().segments(indicesSegmentsRequest, new RestBuilderListener<IndicesSegmentResponse>(channel) {
            @Override
            public RestResponse buildResponse(IndicesSegmentResponse response, XContentBuilder builder) throws Exception {
                builder.startObject();
                buildBroadcastShardsHeader(builder, request, response);
                response.toXContent(builder, request);
                builder.endObject();
                return new BytesRestResponse(OK, builder);
            }
        });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:RestIndicesSegmentsAction.java


示例6: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    IndicesShardStoresRequest indicesShardStoresRequest = new IndicesShardStoresRequest(
            Strings.splitStringByCommaToArray(request.param("index")));
    if (request.hasParam("status")) {
        indicesShardStoresRequest.shardStatuses(Strings.splitStringByCommaToArray(request.param("status")));
    }
    indicesShardStoresRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesShardStoresRequest.indicesOptions()));
    return channel ->
        client.admin()
            .indices()
            .shardStores(indicesShardStoresRequest, new RestBuilderListener<IndicesShardStoresResponse>(channel) {
                @Override
                public RestResponse buildResponse(
                    IndicesShardStoresResponse response,
                    XContentBuilder builder) throws Exception {
                    builder.startObject();
                    response.toXContent(builder, request);
                    builder.endObject();
                    return new BytesRestResponse(OK, builder);
                }
            });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:RestIndicesShardStoresAction.java


示例7: handlePost

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
private RestChannelConsumer handlePost(final RestRequest request, NodeClient client) {
    UpgradeRequest upgradeReq = new UpgradeRequest(Strings.splitStringByCommaToArray(request.param("index")));
    upgradeReq.indicesOptions(IndicesOptions.fromRequest(request, upgradeReq.indicesOptions()));
    upgradeReq.upgradeOnlyAncientSegments(request.paramAsBoolean("only_ancient_segments", false));
    return channel -> client.admin().indices().upgrade(upgradeReq, new RestBuilderListener<UpgradeResponse>(channel) {
        @Override
        public RestResponse buildResponse(UpgradeResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.startObject("upgraded_indices");
            for (Map.Entry<String, Tuple<Version, String>> entry : response.versions().entrySet()) {
                builder.startObject(entry.getKey());
                builder.field("upgrade_version", entry.getValue().v1());
                builder.field("oldest_lucene_segment_version", entry.getValue().v2());
                builder.endObject();
            }
            builder.endObject();
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:RestUpgradeAction.java


示例8: listTasksResponseListener

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
/**
 * Standard listener for extensions of {@link ListTasksResponse} that supports {@code group_by=nodes}.
 */
public static <T extends ListTasksResponse> ActionListener<T> listTasksResponseListener(
            Supplier<DiscoveryNodes> nodesInCluster,
            String groupBy,
            final RestChannel channel) {
    if ("nodes".equals(groupBy)) {
        return new RestBuilderListener<T>(channel) {
            @Override
            public RestResponse buildResponse(T response, XContentBuilder builder) throws Exception {
                builder.startObject();
                response.toXContentGroupedByNode(builder, channel.request(), nodesInCluster.get());
                builder.endObject();
                return new BytesRestResponse(RestStatus.OK, builder);
            }
        };
    } else if ("parents".equals(groupBy)) {
        return new RestToXContentListener<>(channel);
    } else {
        throw new IllegalArgumentException("[group_by] must be one of [nodes] or [parents] but was [" + groupBy + "]");
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:RestListTasksAction.java


示例9: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    final String[] repositories = request.paramAsStringArray("repository", Strings.EMPTY_ARRAY);
    GetRepositoriesRequest getRepositoriesRequest = getRepositoryRequest(repositories);
    getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));
    getRepositoriesRequest.local(request.paramAsBoolean("local", getRepositoriesRequest.local()));
    settingsFilter.addFilterSettingParams(request);
    return channel ->
            client.admin().cluster().getRepositories(getRepositoriesRequest, new RestBuilderListener<GetRepositoriesResponse>(channel) {
                @Override
                public RestResponse buildResponse(GetRepositoriesResponse response, XContentBuilder builder) throws Exception {
                    builder.startObject();
                    for (RepositoryMetaData repositoryMetaData : response.repositories()) {
                        RepositoriesMetaData.toXContent(repositoryMetaData, builder, request);
                    }
                    builder.endObject();

                    return new BytesRestResponse(OK, builder);
                }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:RestGetRepositoriesAction.java


示例10: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    ClusterAllocationExplainRequest req;
    if (request.hasContentOrSourceParam() == false) {
        // Empty request signals "explain the first unassigned shard you find"
        req = new ClusterAllocationExplainRequest();
    } else {
        try (XContentParser parser = request.contentOrSourceParamParser()) {
            req = ClusterAllocationExplainRequest.parse(parser);
        }
    }

    req.includeYesDecisions(request.paramAsBoolean("include_yes_decisions", false));
    req.includeDiskInfo(request.paramAsBoolean("include_disk_info", false));
    return channel -> client.admin().cluster().allocationExplain(req,
        new RestBuilderListener<ClusterAllocationExplainResponse>(channel) {
            @Override
            public RestResponse buildResponse(ClusterAllocationExplainResponse response, XContentBuilder builder) throws IOException {
                response.getExplanation().toXContent(builder, ToXContent.EMPTY_PARAMS);
                return new BytesRestResponse(RestStatus.OK, builder);
            }
        });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:RestClusterAllocationExplainAction.java


示例11: storeModel

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
public RestChannelConsumer storeModel(Client client, String id, String model) {
    PutStoredScriptRequestBuilder storedScriptRequestBuilder;
    try {
        storedScriptRequestBuilder = client.admin().cluster().preparePutStoredScript().setScriptLang(PMMLModelScriptEngineService.NAME)
                .setSource(jsonBuilder().startObject().field("script", model).endObject().bytes());
    } catch (IOException e) {
        throw new ElasticsearchException("cannot store model", e);
    }
    if (id != null) {
        storedScriptRequestBuilder.setId(id);
    }
    return channel -> {
        storedScriptRequestBuilder.execute(new RestBuilderListener<PutStoredScriptResponse>(channel) {
            @Override
            public RestResponse buildResponse(PutStoredScriptResponse response, XContentBuilder builder) throws Exception {
                builder.startObject();
                builder.field("acknowledged", response.isAcknowledged());
                builder.field("id", id);
                builder.endObject();
                return new BytesRestResponse(OK, builder);
            }
        });
    };
}
 
开发者ID:brwe,项目名称:es-token-plugin,代码行数:25,代码来源:RestStoreModelAction.java


示例12: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
    String id = request.param("id");
    final PrepareSpecRequest prepareSpecRequest = new PrepareSpecRequest();
    if (request.content() == null) {
        throw new ElasticsearchException("prepare spec request must have a body");
    }
    prepareSpecRequest.source(new String(BytesReference.toBytes(request.content()), Charset.defaultCharset()));
    if (id != null) {
        prepareSpecRequest.id(id);
    }
    return channel -> {
        client.execute(PrepareSpecAction.INSTANCE, prepareSpecRequest, new RestBuilderListener<PrepareSpecResponse>(channel) {
            @Override
            public RestResponse buildResponse(PrepareSpecResponse response, XContentBuilder builder) throws Exception {
                builder.startObject();
                response.toXContent(builder, request);
                builder.endObject();
                return new BytesRestResponse(OK, builder);
            }
        });
    };

}
 
开发者ID:brwe,项目名称:es-token-plugin,代码行数:25,代码来源:RestPrepareSpecAction.java


示例13: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
    TrainModelRequestBuilder trainModelRequestBuilder = new TrainModelRequestBuilder(client);
    trainModelRequestBuilder.setModelId(request.param("id"));
    try {
        trainModelRequestBuilder.source(request.content());
    } catch (IOException ex) {
        throw new IllegalArgumentException(ex);
    }

    return channel -> {
        trainModelRequestBuilder.execute(new RestBuilderListener<TrainModelResponse>(channel) {
            @Override
            public RestResponse buildResponse(TrainModelResponse response, XContentBuilder builder) throws Exception {
                builder.startObject();
                response.toXContent(builder, request);
                builder.endObject();
                return new BytesRestResponse(OK, builder);
            }
        });
    };
}
 
开发者ID:brwe,项目名称:es-token-plugin,代码行数:23,代码来源:RestTrainModelAction.java


示例14: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
    final AllTermsRequest allTermsRequest = new AllTermsRequest();
    allTermsRequest.index(request.param("index"));
    allTermsRequest.field(request.param("field"));
    allTermsRequest.size(request.paramAsInt("size", 10));
    allTermsRequest.from(request.param("from"));
    allTermsRequest.minDocFreq(request.paramAsLong("min_doc_freq", 0));

    return channel -> {
        client.execute(AllTermsAction.INSTANCE, allTermsRequest, new RestBuilderListener<AllTermsResponse>(channel) {
            @Override
            public RestResponse buildResponse(AllTermsResponse response, XContentBuilder builder) throws Exception {
                builder.startObject();
                response.toXContent(builder, request);
                builder.endObject();
                return new BytesRestResponse(OK, builder);
            }
        });
    };
}
 
开发者ID:brwe,项目名称:es-token-plugin,代码行数:22,代码来源:RestAllTermsAction.java


示例15: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, NodeClient client) throws IOException {
    String id = request.param("id");

    GetStoredScriptRequest getRequest = new GetStoredScriptRequest(id, Script.DEFAULT_TEMPLATE_LANG);

    return channel -> client.admin().cluster().getStoredScript(getRequest, new RestBuilderListener<GetStoredScriptResponse>(channel) {
        @Override
        public RestResponse buildResponse(GetStoredScriptResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            builder.field(_ID_PARSE_FIELD.getPreferredName(), id);

            builder.field(StoredScriptSource.LANG_PARSE_FIELD.getPreferredName(), Script.DEFAULT_TEMPLATE_LANG);

            StoredScriptSource source = response.getSource();
            boolean found = source != null;
            builder.field(FOUND_PARSE_FIELD.getPreferredName(), found);

            if (found) {
                builder.field(StoredScriptSource.TEMPLATE_PARSE_FIELD.getPreferredName(), source.getCode());
            }

            builder.endObject();

            return new BytesRestResponse(found ? RestStatus.OK : RestStatus.NOT_FOUND, builder);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:29,代码来源:RestGetSearchTemplateAction.java


示例16: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    RefreshRequest refreshRequest = new RefreshRequest(Strings.splitStringByCommaToArray(request.param("index")));
    refreshRequest.indicesOptions(IndicesOptions.fromRequest(request, refreshRequest.indicesOptions()));
    return channel -> client.admin().indices().refresh(refreshRequest, new RestBuilderListener<RefreshResponse>(channel) {
        @Override
        public RestResponse buildResponse(RefreshResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            buildBroadcastShardsHeader(builder, request, response);
            builder.endObject();
            return new BytesRestResponse(response.getStatus(), builder);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:RestRefreshAction.java


示例17: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
    final String[] types = request.paramAsStringArrayOrEmptyIfAll("type");
    final String[] fields = Strings.splitStringByCommaToArray(request.param("fields"));
    GetFieldMappingsRequest getMappingsRequest = new GetFieldMappingsRequest();
    getMappingsRequest.indices(indices).types(types).fields(fields).includeDefaults(request.paramAsBoolean("include_defaults", false));
    getMappingsRequest.indicesOptions(IndicesOptions.fromRequest(request, getMappingsRequest.indicesOptions()));
    getMappingsRequest.local(request.paramAsBoolean("local", getMappingsRequest.local()));
    return channel ->
            client.admin().indices().getFieldMappings(getMappingsRequest, new RestBuilderListener<GetFieldMappingsResponse>(channel) {
                @Override
                public RestResponse buildResponse(GetFieldMappingsResponse response, XContentBuilder builder) throws Exception {
                    Map<String, Map<String, Map<String, FieldMappingMetaData>>> mappingsByIndex = response.mappings();

                    boolean isPossibleSingleFieldRequest = indices.length == 1 && types.length == 1 && fields.length == 1;
                    if (isPossibleSingleFieldRequest && isFieldMappingMissingField(mappingsByIndex)) {
                        return new BytesRestResponse(OK, builder.startObject().endObject());
                    }

                    RestStatus status = OK;
                    if (mappingsByIndex.isEmpty() && fields.length > 0) {
                        status = NOT_FOUND;
                    }
                    builder.startObject();
                    response.toXContent(builder, request);
                    builder.endObject();
                    return new BytesRestResponse(status, builder);
                }
            });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:32,代码来源:RestGetFieldMappingAction.java


示例18: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    final String[] names = request.paramAsStringArrayOrEmptyIfAll("name");
    final boolean renderDefaults = request.paramAsBoolean("include_defaults", false);
    GetSettingsRequest getSettingsRequest = new GetSettingsRequest()
            .indices(Strings.splitStringByCommaToArray(request.param("index")))
            .indicesOptions(IndicesOptions.fromRequest(request, IndicesOptions.strictExpandOpen()))
            .humanReadable(request.hasParam("human"))
            .names(names);
    getSettingsRequest.local(request.paramAsBoolean("local", getSettingsRequest.local()));

    return channel -> client.admin().indices().getSettings(getSettingsRequest, new RestBuilderListener<GetSettingsResponse>(channel) {

        @Override
        public RestResponse buildResponse(GetSettingsResponse getSettingsResponse, XContentBuilder builder) throws Exception {
            builder.startObject();
            for (ObjectObjectCursor<String, Settings> cursor : getSettingsResponse.getIndexToSettings()) {
                // no settings, jump over it to shorten the response data
                if (cursor.value.isEmpty()) {
                    continue;
                }
                builder.startObject(cursor.key);
                builder.startObject("settings");
                cursor.value.toXContent(builder, request);
                builder.endObject();
                if (renderDefaults) {
                    builder.startObject("defaults");
                    settingsFilter.filter(indexScopedSettings.diff(cursor.value, settings)).toXContent(builder, request);
                    builder.endObject();
                }
                builder.endObject();
            }
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:38,代码来源:RestGetSettingsAction.java


示例19: prepareRequest

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, IndicesOptions.lenientExpandOpen());
    SyncedFlushRequest syncedFlushRequest = new SyncedFlushRequest(Strings.splitStringByCommaToArray(request.param("index")));
    syncedFlushRequest.indicesOptions(indicesOptions);
    return channel -> client.admin().indices().syncedFlush(syncedFlushRequest, new RestBuilderListener<SyncedFlushResponse>(channel) {
        @Override
        public RestResponse buildResponse(SyncedFlushResponse results, XContentBuilder builder) throws Exception {
            builder.startObject();
            results.toXContent(builder, request);
            builder.endObject();
            return new BytesRestResponse(results.restStatus(), builder);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:RestSyncedFlushAction.java


示例20: handleGet

import org.elasticsearch.rest.action.RestBuilderListener; //导入依赖的package包/类
private RestChannelConsumer handleGet(final RestRequest request, NodeClient client) {
    UpgradeStatusRequest statusRequest = new UpgradeStatusRequest(Strings.splitStringByCommaToArray(request.param("index")));
    statusRequest.indicesOptions(IndicesOptions.fromRequest(request, statusRequest.indicesOptions()));
    return channel -> client.admin().indices().upgradeStatus(statusRequest, new RestBuilderListener<UpgradeStatusResponse>(channel) {
        @Override
        public RestResponse buildResponse(UpgradeStatusResponse response, XContentBuilder builder) throws Exception {
            builder.startObject();
            response.toXContent(builder, request);
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:RestUpgradeAction.java



注:本文中的org.elasticsearch.rest.action.RestBuilderListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IRecipeHandler类代码示例发布时间:2022-05-22
下一篇:
Java TypeNameMatchRequestor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap