# MoreLikeThis change between ES 0.16 and ES 0.17

**URL:** <https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065>\
**Category:** Elasticsearch\
**Created:** [August 5, 2011, 11:32am UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065 "2011-08-05T11:32:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [August 5, 2011, 11:32am UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065/1 "2011-08-05T11:32:43Z")

</div>

Hi

@juneym just made a pull request for Elastica with the MoreLikeThis query:

> <https://github.com/ruflin/Elastica/pull/63>

Now it seems like the query is running under 0.16 but does not work under  
0.17. The query looks the following:

- 

```
       [more_like_this] => Array*

```

- 

```
           (*

```

- 

```
               [fields] => Array*

```

- 

```
                   (*

```

- 

```
                       [0] => email*

```

- 

```
                       [1] => content*

```

- 

```
                   )*

```

- 
- 
- 

```
               [boost] => 1*

```

- 

```
               [like_text] => fake gmail sample*

```

- 

```
               [max_query_terms] => 1*

```

- 

```
               [percent_terms_to_match] => 0.3*

```

- 

```
               [min_term_freq] => 1*

```

- 

```
               [min_doc_freq] => 1*

```

- 

```
               [max_doc_freq] => *

```

- 

```
               [min_word_len] => 0*

```

- 

```
               [max_word_len] => 0*

```

- 

```
               [boost_terms] => 1*

```

- 

```
           )*

```

- 
- 
- 

```
   )*

```

And elasticsearch throws the following error

[_2011-08-05 12:26:05,427][DEBUG][action.search.type] [Lorna Dane]  
[test][0], node[XC2VHqNjQsmuGCUIfVOPVA], [P], s[STARTED]: Failed to execute  
[org.elasticsearch.action.search.SearchRequest@58c3d9ac]_  
_org.elasticsearch.search.query.QueryPhaseExecutionException: [test][0]:  
query[like:fake gmail sample],from[0],size[10]: Query Failed [Failed to  
execute main query]_

- at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:221)\*
- at  
org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:295)
- 
- at  
org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteFetch(SearchServiceTransportAction.java:224)
- 
- at  
org.elasticsearch.action.search.type.TransportSearchQueryAndFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryAndFetchAction.java:71)
- 
- at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:204)
- 
- at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:191)
- 
- at  
org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:177)
- 
- at  
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
- 
- at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
- 
- at java.lang.Thread.run(Thread.java:680)\*  
_Caused by: java.io.IOException: Stream closed_

Any idea what is wrong with this query? I tried to figure out what changed  
between ES 0.16 and 0.17, but couldn't figure out what it is.

---

<div class="post-metadata">

**Author:** ![Vladimir\_Shkurin](https://avatars.discourse-cdn.com/v4/letter/v/94ad74/32.png) [@Vladimir\_Shkurin](https://discuss.elastic.co/u/Vladimir_Shkurin)\
**Post date:** [August 5, 2011, 3:09pm UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065/2 "2011-08-05T15:09:18Z")

</div>

I also meet with this. The problem in "fields" parameter.

Here's a sample query and it don't work:

> <https://gist.github.com/kimchy/553660>

But if you remove the "fields", the query works 🙂

- Offtop \*

Shay, I have another question about relevance. MLT function in  
ElasticSearch working not as good as in Solr, the problem in fields  
weight. I have set "boost" for the fields in the mapping, but they are  
ignored. Could you make that request could look like for the  
query\_string { "fields" : ["title^7", "tags^3", "categories^2",  
"description"] } ?

Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![yark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yark/32/3148_2.png) [@yark](https://discuss.elastic.co/u/yark)\
**Post date:** [August 5, 2011, 3:13pm UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065/3 "2011-08-05T15:13:12Z")

</div>

There is a typo in docs. fields must be a mlt\_fields

5 серп. 2011, в 18:09, Vladimir Shkurin написал(а):

> I also meet with this. The problem in "fields" parameter.
> 
> Here's a sample query and it don't work:
> 
> [gist:553660 · GitHub](https://gist.github.com/553660)
> 
> But if you remove the "fields", the query works 🙂
> 
> - Offtop \*
> 
> Shay, I have another question about relevance. MLT function in  
> Elasticsearch working not as good as in Solr, the problem in fields  
> weight. I have set "boost" for the fields in the mapping, but they are  
> ignored. Could you make that request could look like for the  
> query\_string { "fields" : ["title^7", "tags^3", "categories^2",  
> "description"] } ?
> 
> Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![Vladimir\_Shkurin](https://avatars.discourse-cdn.com/v4/letter/v/94ad74/32.png) [@Vladimir\_Shkurin](https://discuss.elastic.co/u/Vladimir_Shkurin)\
**Post date:** [August 5, 2011, 3:30pm UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065/4 "2011-08-05T15:30:33Z")

</div>

Yaroslav, "mlt\_fields" or "mlt\_fieldsafaf" is work, but it has no  
effect 🙂 Because the parameter "mlt\_fields" for More Like This API,  
not for More Like This Query 🙂

---

<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:** [August 5, 2011, 8:34pm UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065/5 "2011-08-05T20:34:21Z")

</div>

This looks like this bug in Lucene:  
[[LUCENE-3326] MoreLikeThis reuses a reader after it has already closed it - ASF JIRA](https://issues.apache.org/jira/browse/LUCENE-3326). It will be fixed in 3.4,  
I will see if I can workaround it for now.

On Fri, Aug 5, 2011 at 6:30 PM, Vladimir Shkurin [vshkurin@gmail.com](mailto:vshkurin@gmail.com) wrote:

> Yaroslav, "mlt\_fields" or "mlt\_fieldsafaf" is work, but it has no  
> effect 🙂 Because the parameter "mlt\_fields" for More Like This API,  
> not for More Like This Query 🙂

---

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [August 6, 2011, 10:40am UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065/6 "2011-08-06T10:40:35Z")

</div>

It works when I rename fields to mlt\_fields. But if I understand you right,  
the fields can be completely skipped as they don't have any affect? This  
means, they probably should be removed from the docu?  
[http://www.elasticsearch.org/guide/reference/query-dsl/mlt-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/mlt-query.html)

---

<div class="post-metadata">

**Author:** ![Vladimir\_Shkurin](https://avatars.discourse-cdn.com/v4/letter/v/94ad74/32.png) [@Vladimir\_Shkurin](https://discuss.elastic.co/u/Vladimir_Shkurin)\
**Post date:** [August 6, 2011, 11:10am UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065/7 "2011-08-06T11:10:08Z")

</div>

No need to delete anything, this section of the documentation is  
correct. We just have to wait when will the new release of Lucene, or  
maybe Shay can fix it earlier 🙂

---

<div class="post-metadata">

**Author:** ![ruflin\_2](https://avatars.discourse-cdn.com/v4/letter/r/a8b319/32.png) [@ruflin\_2](https://discuss.elastic.co/u/ruflin_2)\
**Post date:** [August 7, 2011, 9:51am UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065/8 "2011-08-07T09:51:33Z")

</div>

Ok, good to know.

---

<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, 3:58am UTC](https://discuss.elastic.co/t/morelikethis-change-between-es-0-16-and-es-0-17/5065/9 "2017-07-06T03:58:01Z")

</div>


