# moreLikeThisRequest Question

**URL:** <https://discuss.elastic.co/t/morelikethisrequest-question/2969>\
**Category:** Elasticsearch\
**Created:** [May 25, 2010, 8:01am UTC](https://discuss.elastic.co/t/morelikethisrequest-question/2969 "2010-05-25T08:01:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yatir\_Ben\_Shlomo\_2](https://avatars.discourse-cdn.com/v4/letter/y/76d3ee/32.png) [@Yatir\_Ben\_Shlomo\_2](https://discuss.elastic.co/u/Yatir_Ben_Shlomo_2)\
**Post date:** [May 25, 2010, 8:01am UTC](https://discuss.elastic.co/t/morelikethisrequest-question/2969/1 "2010-05-25T08:01:20Z")

</div>

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();

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [May 25, 2010, 8:21am UTC](https://discuss.elastic.co/t/morelikethisrequest-question/2969/2 "2010-05-25T08:21:39Z")

</div>

Hi,

I think you can use the same API as used in the example here:  
[http://www.elasticsearch.com/docs/elasticsearch/java\_api/search/](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.com](mailto:maanit.arch@gmail.com)wrote:

> 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();

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [May 25, 2010, 6:45pm UTC](https://discuss.elastic.co/t/morelikethisrequest-question/2969/3 "2010-05-25T18:45:31Z")

</div>

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](mailto: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/](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.com](mailto:maanit.arch@gmail.com)wrote:
> 
> > 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();

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:23am UTC](https://discuss.elastic.co/t/morelikethisrequest-question/2969/4 "2017-07-06T04:23:52Z")

</div>

Closed on July 6, 2017, 4:23am UTC


