moreLikeThisRequest Question


(Yatir Ben Shlomo-2) #1

Hi I am using version 0.7.1 and a TransportClient to do mlt

how do I modify this code so that

  1. I can control the number of results I will get and not just the
    default first 10
  2. turn on the explain flag so I will be able to get the lucene score
    on each hit

MoreLikeThisRequest request =
moreLikeThisRequest("en").type("organic").id(docId).fields("content");
SearchResponse mltResponse =
client.moreLikeThis(request).actionGet();


(Lukáš Vlček) #2

Hi,

I think you can use the same API as used in the example here:
http://www.elasticsearch.com/docs/elasticsearch/java_api/search/

Regards,
Lukas

On Tue, May 25, 2010 at 10:01 AM, Yatir Ben Shlomo maanit.arch@gmail.comwrote:

Hi I am using version 0.7.1 and a TransportClient to do mlt

how do I modify this code so that

  1. I can control the number of results I will get and not just the
    default first 10
  2. turn on the explain flag so I will be able to get the lucene score
    on each hit

MoreLikeThisRequest request =
moreLikeThisRequest("en").type("organic").id(docId).fields("content");
SearchResponse mltResponse =
client.moreLikeThis(request).actionGet();


(Shay Banon) #3

If you want to provide the text for the more like this query, then you
should execute a simple search request (not mlt) and add an mlt query to it
(with the text itself).

For the mlt API, you can provide the search request parameters under the
searchSource parameter.

cheers,
shay.banon

On Tue, May 25, 2010 at 11:21 AM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

I think you can use the same API as used in the example here:
http://www.elasticsearch.com/docs/elasticsearch/java_api/search/

Regards,
Lukas

On Tue, May 25, 2010 at 10:01 AM, Yatir Ben Shlomo maanit.arch@gmail.comwrote:

Hi I am using version 0.7.1 and a TransportClient to do mlt

how do I modify this code so that

  1. I can control the number of results I will get and not just the
    default first 10
  2. turn on the explain flag so I will be able to get the lucene score
    on each hit

MoreLikeThisRequest request =
moreLikeThisRequest("en").type("organic").id(docId).fields("content");
SearchResponse mltResponse =
client.moreLikeThis(request).actionGet();


(system) #4