More_like_this documentation


(Yehosef) #1

I'm a little confused by the documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-mlt-query.html.

One issue is that I'm trying to do a query using other documents as reference for finding similar.

"like": [
          {"_id": "16083773"},
          {"_id": "16084243"}
        ],

This works (I still have issues with relevance, etc - but it works.) But in the docs it says that you can use an ids field but that doesn't seem to work. like_text also meets with a [mlt] query does not support [like_text]

I also cannot find an acceptable way to use the Query Formation Parameters (esp. minimum_should_match).

Are there some examples using the MLT query and these features?


(Yehosef) #2

Seems like from https://www.elastic.co/guide/en/elasticsearch/reference/2.4/query-dsl-mlt-query.html
that the ids and like_text was depreciated. I guess just not removed from the docs.

Now my minimum_should_match is working (at the same level as the other Term Select Parameters. Not sure why it was't working before.


(Mark Harwood) #3

I opened an issue to flag the incorrect docs.
It includes an example of how the old ids and like_text functionality is achieved using the new unified like parameter


(Yehosef) #4

Thanks. But what also wasn't clear was that the MLT docs say the it uses the syntax of the Multi GET which allows for

GET /test/type/_mget
{
    "ids" : ["1", "2"]
}

And it doesn't seem that's supported, or if it is, I couldn't figure out how to use it. After reading of the MLT docs again, I noticed:

The syntax to specify documents is similar to the one used by the Multi GET API.

So I don't know if that mean the short ids syntax is supported (but I don't know how to use it) or not.


(Mark Harwood) #5

There's an example in the linked issue I shared


(Yehosef) #6

The example in the issue is basically the same as that in the documentation.

I was pointing out that the MLT docs says that it (basically) uses the MultiGET syntax, one of which is ids:["1","2"]. But that syntax doesn't seem to work for the MLT. I'm not saying it's a bug.. just caused me some confusion especially since the ids syntax used to be supported for MLT.

Ideally, I would think either MLT should support short ids

"like": {
    "ids": ["1","2","3"]
}

or that there is an explicit reference that MLT supports the MultiGET syntax, except for short ids.


(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.