Package org.elasticsearch.action.get

Examples of org.elasticsearch.action.get.GetResponse


        return percolatorExistsInIndex(namePercolator, INDEX_DEFAULT);
    }

    public static boolean percolatorExistsInIndex(String namePercolator, String indexName){
        try {
            GetResponse responseExist = IndexService.getPercolator(indexName, namePercolator);
            return (responseExist.isExists());
        } catch (IndexMissingException e) {
            return false;
        }
    }
View Full Code Here


        sendBody("direct:index", map);
        String indexId = template.requestBody("direct:index", map, String.class);
        assertNotNull("indexId should be set", indexId);

        //now, verify GET succeeded
        GetResponse response = template.requestBody("direct:get", indexId, GetResponse.class);
        assertNotNull("response should not be null", response);
        assertNotNull("response source should not be null", response.getSource());
    }
View Full Code Here

        sendBody("direct:index", map);
        String indexId = template.requestBody("direct:index", map, String.class);
        assertNotNull("indexId should be set", indexId);

        //now, verify GET succeeded
        GetResponse response = template.requestBody("direct:get", indexId, GetResponse.class);
        assertNotNull("response should not be null", response);
        assertNotNull("response source should not be null", response.getSource());

        //now, perform DELETE
        DeleteResponse deleteResponse = template.requestBody("direct:delete", indexId, DeleteResponse.class);
        assertNotNull("response should not be null", deleteResponse);

        //now, verify GET fails to find the indexed value
        response = template.requestBody("direct:get", indexId, GetResponse.class);
        assertNotNull("response should not be null", response);
        assertNull("response source should be null", response.getSource());
    }
View Full Code Here

        String indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);

        //now, verify GET
        headers.put(ElasticsearchConfiguration.PARAM_OPERATION, ElasticsearchConfiguration.OPERATION_GET_BY_ID);
        GetResponse response = template.requestBodyAndHeaders("direct:start", indexId, headers, GetResponse.class);
        assertNotNull("response should not be null", response);
        assertNotNull("response source should not be null", response.getSource());
    }
View Full Code Here

        String indexId = template.requestBodyAndHeaders("direct:start", map, headers, String.class);

        //now, verify GET
        headers.put(ElasticsearchConfiguration.PARAM_OPERATION, ElasticsearchConfiguration.OPERATION_GET_BY_ID);
        GetResponse response = template.requestBodyAndHeaders("direct:start", indexId, headers, GetResponse.class);
        assertNotNull("response should not be null", response);
        assertNotNull("response source should not be null", response.getSource());

        //now, perform DELETE
        headers.put(ElasticsearchConfiguration.PARAM_OPERATION, ElasticsearchConfiguration.OPERATION_DELETE);
        DeleteResponse deleteResponse = template.requestBodyAndHeaders("direct:start", indexId, headers, DeleteResponse.class);
        assertNotNull("response should not be null", deleteResponse);

        //now, verify GET fails to find the indexed value
        headers.put(ElasticsearchConfiguration.PARAM_OPERATION, ElasticsearchConfiguration.OPERATION_GET_BY_ID);
        response = template.requestBodyAndHeaders("direct:start", indexId, headers, GetResponse.class);
        assertNotNull("response should not be null", response);
        assertNull("response source should be null", response.getSource());
    }
View Full Code Here

            indexType = getEndpoint().getConfig().getIndexType();
        }

        String indexId = exchange.getIn().getBody(String.class);

        GetResponse response = client.prepareGet(indexName, indexType, indexId).execute().actionGet();
        exchange.getIn().setBody(response);
    }
View Full Code Here

        refresh();
    }

    private void waitForChange(final String riverName, final String lastupdate_id) throws InterruptedException {
        String date = "";
        GetResponse getResponse = client().prepareGet("_river", riverName, lastupdate_id)
                .setFields("rss." + lastupdate_id)
                .execute().actionGet();
        if (getResponse.isExists()) {
            date = getResponse.getField("rss." + lastupdate_id).getValue().toString();
        }

        final String finalDate = date;
        assertThat("Date should have changed " + date, awaitBusy(new Predicate<Object>() {
            @Override
            public boolean apply(Object o) {
                GetResponse getResponse = client().prepareGet("_river", riverName, lastupdate_id)
                        .setFields("rss." + lastupdate_id)
                        .execute().actionGet();
                String new_date = "";
                if (getResponse.isExists() && getResponse.getField("rss." + lastupdate_id) != null) {
                    new_date = getResponse.getField("rss." + lastupdate_id).getValue().toString();
                }
                return !finalDate.equals(new_date);
            }
        }, 10, TimeUnit.SECONDS), equalTo(true));
    }
View Full Code Here

        if(message instanceof MetadataResource) {

            final MetadataResource resource = (MetadataResource) message;

            String index = ConfigFactory.load().getString("restopengov.index");
            GetResponse response = client.prepareGet(index, resource.metadata_name, resource.id).execute().actionGet();

            if(response.getSource() != null) {
                String hash = (String) response.getSource().get("hash");

                if(resource.hash == hash) {
                    Crawler.logger.info(resource.name + " didn't change, not crawling");
                    return;
                }
View Full Code Here

            Metadata metadata = (Metadata) message;

            String index = ConfigFactory.load().getString("restopengov.index");

            GetResponse response = client.prepareGet(index, "metadata", metadata.name).execute().actionGet();

            String modified = null;

            if(response.getSource() != null) {
                modified = (String) response.getSource().get("metadata_modified");

                if(DateChecker.compare(metadata.metadata_modified, modified) <= 0) {
                    Crawler.logger.info("Metadata for " + metadata.name + " didn't change, not crawling");
                    return;
                }
View Full Code Here

        if (message instanceof MetadataResource) {

            final MetadataResource resource = (MetadataResource) message;

            String index = ConfigFactory.load().getString("restopengov.index");
            GetResponse response = client.prepareGet(index, resource.metadata_name, resource.id).execute().actionGet();

            if(response.getSource() != null) {
                String hash = (String) response.getSource().get("hash");

                if(resource.hash == hash) {
                    Crawler.logger.info(resource.name + " didn't change, not crawling");
                    return;
                }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.get.GetResponse

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.