Package org.elasticsearch.action.exists

Examples of org.elasticsearch.action.exists.ExistsRequest


     * @param indices The indices to count matched documents against a query. Use <tt>null</tt> or <tt>_all</tt> to execute against all indices
     * @return The exists request
     * @see org.elasticsearch.client.Client#exists(org.elasticsearch.action.exists.ExistsRequest)
     */
    public static ExistsRequest existsRequest(String... indices) {
        return new ExistsRequest(indices);
    }
View Full Code Here


        super(settings, controller, client);
    }

    @Override
    public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
        final ExistsRequest existsRequest = new ExistsRequest(Strings.splitStringByCommaToArray(request.param("index")));
        existsRequest.indicesOptions(IndicesOptions.fromRequest(request, existsRequest.indicesOptions()));
        existsRequest.listenerThreaded(false);
        if (request.hasContent()) {
            existsRequest.source(request.content(), request.contentUnsafe());
        } else {
            String source = request.param("source");
            if (source != null) {
                existsRequest.source(source);
            } else {
                QuerySourceBuilder querySourceBuilder = RestActions.parseQuerySource(request);
                if (querySourceBuilder != null) {
                    existsRequest.source(querySourceBuilder);
                }
            }
        }
        existsRequest.routing(request.param("routing"));
        existsRequest.minScore(request.paramAsFloat("min_score", DEFAULT_MIN_SCORE));
        existsRequest.types(Strings.splitStringByCommaToArray(request.param("type")));
        existsRequest.preference(request.param("preference"));

        client.exists(existsRequest, new RestBuilderListener<ExistsResponse>(channel) {
            @Override
            public RestResponse buildResponse(ExistsResponse response, XContentBuilder builder) throws Exception {
                RestStatus status = response.exists() ? OK : NOT_FOUND;
View Full Code Here

    @Test
    public void testExists() {
        String existsShardAction = ExistsAction.NAME + "[s]";
        interceptTransportActions(existsShardAction);

        ExistsRequest existsRequest = new ExistsRequest(randomIndicesOrAliases());
        internalCluster().clientNodeClient().exists(existsRequest).actionGet();

        clearInterceptedActions();
        assertSameIndices(existsRequest, existsShardAction);
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.exists.ExistsRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.