I am having trouble translating following ElasticSearch NodeClient query
to JestClient. I have something along the lines of
SearchResponse sr = client.prepareSearch("myindex")
.setTypes("myproducts")
.setSearchType(SearchType.COUNT)
.setQuery(QueryBuilders.matchAllQuery())
.addFacet(FacetBuilders.termsFacet("facetname").field("someattr"))
.execute().actionGet();
I know how to set index, type and query but am stuck at searchtype, facet.
Would it be ok to create a SearchRequestBuilder with null client and pass
it the TermQueryBuilder and FacetBuilder and then convert the query to
string and pass it to JestClient (Search.createQuueryWithBuilders)?
Search search = new Search(query);
search.addIndex("terms_facet");
search.addType("document");
JestResult result = client.execute(search);
List termsFacets = result.getFacets(TermsFacet.class);
On Sunday, March 10, 2013 8:20:03 AM UTC+2, Mihir M wrote:
Hi,
I am having trouble translating following Elasticsearch NodeClient query
to JestClient. I have something along the lines of
SearchResponse sr = client.prepareSearch("myindex")
.setTypes("myproducts")
.setSearchType(SearchType.COUNT)
.setQuery(QueryBuilders.matchAllQuery())
.addFacet(FacetBuilders.termsFacet("facetname").field("someattr"))
.execute().actionGet();
I know how to set index, type and query but am stuck at searchtype, facet.
Would it be ok to create a SearchRequestBuilder with null client and pass
it the TermQueryBuilder and FacetBuilder and then convert the query to
string and pass it to JestClient (Search.createQuueryWithBuilders)?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.