How to _count command by transportclient in v5.3.0?

eg.

request url : http://localhost:9200/testlog/_count
request body :
{
"query":{
"bool":{
"should":[{
"match":{
"operator":"abcd"
}},
{"match":{
"content":"测试"
}}

	]
}

}
}

how to use java api by transportclient?

SearchResponse response = client.prepareSearch(indexs.split(","))
.setTypes(types.split(","))
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.boolQuery()) // Query
.setExplain(true)
.get();

Has it have Similar query methods like Java API?

Setting the size to 0 should pretty much do it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.