# Elastic Search MLT API, how to use fields with weights

**URL:** <https://discuss.elastic.co/t/elastic-search-mlt-api-how-to-use-fields-with-weights/15922>\
**Category:** Elasticsearch\
**Created:** [February 20, 2014, 11:10am UTC](https://discuss.elastic.co/t/elastic-search-mlt-api-how-to-use-fields-with-weights/15922 "2014-02-20T11:10:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pir\_Abdul\_Rasool\_Qur](https://avatars.discourse-cdn.com/v4/letter/p/ac91a4/32.png) [@Pir\_Abdul\_Rasool\_Qur](https://discuss.elastic.co/u/Pir_Abdul_Rasool_Qur)\
**Post date:** [February 20, 2014, 11:10am UTC](https://discuss.elastic.co/t/elastic-search-mlt-api-how-to-use-fields-with-weights/15922/1 "2014-02-20T11:10:09Z")

</div>

Hi,

I want to use ElasticSearch MLT API, to find a set of documents similar to  
a document in my index. Since, I do not have "like\_text" and do not want to  
make an extra request for retrieving "like text", I am using MLT API with  
document Id. The problem is that in our schema some fields weight more  
than other. For example, keywords\_1 has double weight than keywords\_2. Let  
us say I want to calculate "more like this" on these two fields, How can I  
do that?

I have already tried using mlt\_fields=keywords\_1^2,keywords\_2 but it is not  
working as it is expected. On empirical testing it appears that it is  
treating both fields as equal.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/665ae7cd-48b6-4776-b75c-d5cbb87e11ed%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/665ae7cd-48b6-4776-b75c-d5cbb87e11ed%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 20, 2014, 3:20pm UTC](https://discuss.elastic.co/t/elastic-search-mlt-api-how-to-use-fields-with-weights/15922/2 "2014-02-20T15:20:36Z")

</div>

I do not believe you can boost individual fields/terms separately in a MLT  
query. Your best bet is to probably run a bool query of multiple MLT  
queries each with a different field and boost, but you'll need to first  
extract the MLT text before you can do this.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d3450173-b0af-4b8e-900c-54c68f2c382a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d3450173-b0af-4b8e-900c-54c68f2c382a%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Alex\_Ksikes1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_ksikes1/32/1534_2.png) [@Alex\_Ksikes1](https://discuss.elastic.co/u/Alex_Ksikes1)\
**Post date:** [May 6, 2014, 10:23am UTC](https://discuss.elastic.co/t/elastic-search-mlt-api-how-to-use-fields-with-weights/15922/3 "2014-05-06T10:23:23Z")

</div>

I'd like to add to this that mlt API is the same as a boolean query DSL  
made of multiple more like this field clauses, where each field is set to  
the content of the field of the queried document.

On Thursday, February 20, 2014 4:20:36 PM UTC+1, Binh Ly wrote:

> I do not believe you can boost individual fields/terms separately in a MLT  
> query. Your best bet is to probably run a bool query of multiple MLT  
> queries each with a different field and boost, but you'll need to first  
> extract the MLT text before you can do this.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/2fcd0453-58dc-4a66-b7d9-2e785a2a7fa6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2fcd0453-58dc-4a66-b7d9-2e785a2a7fa6%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:31am UTC](https://discuss.elastic.co/t/elastic-search-mlt-api-how-to-use-fields-with-weights/15922/4 "2017-07-06T01:31:26Z")

</div>


