# Sending query arguments within body of MLT API call. Query has no effect

**URL:** <https://discuss.elastic.co/t/sending-query-arguments-within-body-of-mlt-api-call-query-has-no-effect/11604>\
**Category:** Elasticsearch\
**Created:** [April 16, 2013, 8:46pm UTC](https://discuss.elastic.co/t/sending-query-arguments-within-body-of-mlt-api-call-query-has-no-effect/11604 "2013-04-16T20:46:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marlo](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@marlo](https://discuss.elastic.co/u/marlo)\
**Post date:** [April 16, 2013, 8:46pm UTC](https://discuss.elastic.co/t/sending-query-arguments-within-body-of-mlt-api-call-query-has-no-effect/11604/1 "2013-04-16T20:46:59Z")

</div>

I'm using the MLT API to get related documents. In other posts I've seen  
you can supply additional params within the body of the call. Technically  
I'm using PHP/Elastica, but I was able to track down the eventual curl call  
being made:

[http://search-add-es-a.dev.use1.nytimes.com:80/add/article/516bfb05ac02f560850017f1/\_mlt?mlt\_fields=body%2Cheadline&min\_doc\_frequency=1](http://search-add-es-a.dev.use1.nytimes.com:80/add/article/516bfb05ac02f560850017f1/_mlt?mlt_fields=body%2Cheadline&min_doc_frequency=1)'  
-d  
'{  
"from":0,  
"size":30,  
"query":  
{"custom\_filters\_score":

{"filters":[{"filter":{"range":{"pub\_date":{"from":"2012-01-01T0:00:00Z"}}},"boost":"1"}],  
query":{"match\_all":{}}  
}  
}  
}'

What I'm trying to accomplish here is in addition to related documents  
returned from MLT query, I want to boost certain articles that begin with a  
certain date, as well as provide search from and search size fields. From  
what I"ve seen, nothing actually happens. The query returns w/ no errors,  
but I don't see any boosting, and I still get back my usual 10 results so  
I'm thinking the 'query body' is not being respected. Is there an issue w/  
my syntax or perhaps my version of elasticsearch (0.19.11)?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [April 18, 2013, 8:14am UTC](https://discuss.elastic.co/t/sending-query-arguments-within-body-of-mlt-api-call-query-has-no-effect/11604/2 "2013-04-18T08:14:01Z")

</div>

Yes, the query body isn't respected. The search request body you can  
specify with the mlt api is meant for providing anything but a query  
(facet, top level filter, highlighting etc.). The query that is generated  
by the mlt api is replaced by the query you specify in the request body.

On 16 April 2013 22:46, Marlo Epres [mepres@gmail.com](mailto:mepres@gmail.com) wrote:

> I'm using the MLT API to get related documents. In other posts I've seen  
> you can supply additional params within the body of the call. Technically  
> I'm using PHP/Elastica, but I was able to track down the eventual curl call  
> being made:
> 
> [http://search-add-es-a.dev.use1.nytimes.com:80/add/article/516bfb05ac02f560850017f1/\_mlt?mlt\_fields=body%2Cheadline&min\_doc\_frequency=1](http://search-add-es-a.dev.use1.nytimes.com:80/add/article/516bfb05ac02f560850017f1/_mlt?mlt_fields=body%2Cheadline&min_doc_frequency=1)'  
> -d  
> '{  
> "from":0,  
> "size":30,  
> "query":  
> {"custom\_filters\_score":
> 
> {"filters":[{"filter":{"range":{"pub\_date":{"from":"2012-01-01T0:00:00Z"}}},"boost":"1"}],  
> query":{"match\_all":{}}  
> }  
> }  
> }'
> 
> What I'm trying to accomplish here is in addition to related documents  
> returned from MLT query, I want to boost certain articles that begin with a  
> certain date, as well as provide search from and search size fields. From  
> what I"ve seen, nothing actually happens. The query returns w/ no errors,  
> but I don't see any boosting, and I still get back my usual 10 results so  
> I'm thinking the 'query body' is not being respected. Is there an issue w/  
> my syntax or perhaps my version of elasticsearch (0.19.11)?
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
Met vriendelijke groet,

Martijn van Groningen

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:40am UTC](https://discuss.elastic.co/t/sending-query-arguments-within-body-of-mlt-api-call-query-has-no-effect/11604/3 "2017-07-06T02:40:40Z")

</div>


