Elasticsearch 5.4.0 - not like operation

Hello. I am new to new version. I used 2.0.0 and it was possible to make a request 'NOT LIKE':

QueryBuilder qb = notQuery( wildcardQuery( "user", "k?mc*" ) );

But in new version I can't find how to make this request with NOT. Could you explain me how to build this request or it is impossible?

QueryBuilder qb = wildcardQuery("user", "k?mc*");

Use a boolQuery with a must_not clause.

Thank you. I've done it but thought about any other solution.

I have one question more: in old version I used SearchType.COUNT in Java API to count all matched documents to my query. In new version there is a documentation about COUNT API https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html but how is it implemented in JAVA API?

Just run a normal search with setSize(0) and you will get a similar result.

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