Could not find commonTermsQuery api for elasticsearch5.1.1

it could not find commonTermsQuery api for elasticsearch5.1.1, detail below:
//set cluster name
Settings settings = Settings.builder().put("cluster.name", "es5-cluster").build();
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(
new InetSocketTransportAddress(InetAddress.getByName("127.0.0.1"), 9300));// 127.0.0.1

//it could not find below api
QueryBuilder qb = commonTermsQuery("name","kimchy");

already added dependcy in pom.xml:

<dependency>
	<groupId>org.elasticsearch</groupId>
	<artifactId>elasticsearch</artifactId>
	<version>5.1.1</version>
</dependency>	

<!-- https://mvnrepository.com/artifact/org.elasticsearch.client/transport -->
<dependency>
	<groupId>org.elasticsearch.client</groupId>
	<artifactId>transport</artifactId>
	<version>5.1.1</version>
</dependency>

please help, thanks~~~

Hi,

commonTermsQuery() is a static helper method in org.elasticsearch.index.query.QueryBuilders. So either import QueryBuilders and then do QueryBuilders.commonTermsQuery("name","kimchy"); or do a static import and you can ommit the class. Hope that helps.

hi, thanks your reply, it may fix my question^_^.

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