Package org.elasticsearch.index.query

Examples of org.elasticsearch.index.query.TermQueryBuilder


        SearchResponse searchResponse = client.prepareSearch().setQuery(wrapper).execute().actionGet();
        assertThat(searchResponse.hits().totalHits(), equalTo(1l));

        BoolQueryBuilder bool = new BoolQueryBuilder();
        bool.must(wrapper);
        bool.must(new TermQueryBuilder("field2", "value2_1"));

        searchResponse = client.prepareSearch().setQuery(wrapper).execute().actionGet();
        assertThat(searchResponse.hits().totalHits(), equalTo(1l));

    }
View Full Code Here


        SearchHit hit4 = hits4.getHits()[0];
        assertThat("First should be exact match and has score 1", hit4.getScore(), equalTo(2.0f));
        assertImageScore(hits4, nameToSearch, 2.0f);

        // test search metadata
        TermQueryBuilder termQueryBuilder = QueryBuilders.termQuery("img.metadata.exif_ifd0.x_resolution", "72 dots per inch");
        SearchResponse searchResponse5 = client().prepareSearch(INDEX_NAME).setTypes(DOC_TYPE_NAME).setQuery(termQueryBuilder).setSize(totalImages).get();
        assertNoFailures(searchResponse5);
        SearchHits hits5 = searchResponse5.getHits();
        assertThat("Should match at least one record", hits5.getTotalHits(), greaterThanOrEqualTo(1l)); // if using hash, total result maybe different than number of images
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.query.TermQueryBuilder

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.