How to use more_like_this in Java 5.0.0?


(Nikhil Joshi) #1

I am trying to implement MoreLikeThisQueryBuilder but it is not returning result. I am wondering if someone can share end-to-end working example in Java API 5.0.0?

TransportClient c = .....;
String [] strArr = new String[1];strArr[0] = "maths";
MoreLikeThisQueryBuilder queryBuilder = QueryBuilders.moreLikeThisQuery(strArr).minimumShouldMatch("80%");
SearchResponse mltResponse = c.search(Requests.searchRequest("school").types("book").source(new SearchSourceBuilder().query(queryBuilder))).get();

(Alexander Reelsen) #2

How do you know that the response has to return something? Can you provide a full example (preferrably using curl or console syntax) to reproduce this issue? Otherwise it is hard to impossible to debug.


(Nikhil Joshi) #3

Thanks @spinscale, I am looking for Java syntax of MoreLikeThisQueryBuilder, where to put index, type, like text/id etc... If you can provide any example, that will really help.


(system) #4

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