How apply a filter on MLT request with Java API?

As I want to perform MLT query with doc id in my hand, I have two questions.

  1. Is it possible to perform MLT query by passing just a docID in case
    where the _source is disabled? Reason is my document size will be large, so
    I don't feel it feasible either to send a like_text or enabling _source as
    both can explode the memory requirements.

  2. How can I apply a filter on the MLT request from Java API?

--

  1. yes, you can use the fields parameter to use mlt without an enabled
    _source. Only if you do not provide fields, mlt is falling back to use
    _source

  2. mlt filter is not implemented at the moment, but it seems possible by
    introducing a filter parameter to the mlt action

Cheers,

Jörg

On Friday, November 16, 2012 9:52:51 AM UTC+1, Atharva Patel wrote:

As I want to perform MLT query with doc id in my hand, I have two
questions.

  1. Is it possible to perform MLT query by passing just a docID in case
    where the _source is disabled? Reason is my document size will be large, so
    I don't feel it feasible either to send a like_text or enabling _source as
    both can explode the memory requirements.

  2. How can I apply a filter on the MLT request from Java API?

--

Thanks for the reply Jorg!

When I try out performing MTL query using MLT API http://goo.gl/oEwFH, it
gives me error:
{"error":"ElasticSearchException[No fields found to fetch the 'likeText'
from]","status":500}

Am I missing something? I would like to highlight that I am neither storing
the fields or enabling _source. Is it still possible to perform MLT query
with that docID? How? I have mentioned the fields 'analyzed'. Do I need to
do anything else also?

On Monday, 19 November 2012 05:55:33 UTC+5:30, Jörg Prante wrote:

  1. yes, you can use the fields parameter to use mlt without an enabled
    _source. Only if you do not provide fields, mlt is falling back to use
    _source

  2. mlt filter is not implemented at the moment, but it seems possible by
    introducing a filter parameter to the mlt action

Cheers,

Jörg

On Friday, November 16, 2012 9:52:51 AM UTC+1, Atharva Patel wrote:

As I want to perform MLT query with doc id in my hand, I have two
questions.

  1. Is it possible to perform MLT query by passing just a docID in case
    where the _source is disabled? Reason is my document size will be large, so
    I don't feel it feasible either to send a like_text or enabling _source as
    both can explode the memory requirements.

  2. How can I apply a filter on the MLT request from Java API?

--

Hi Atharva,

if you don't have fields stored, and no _source is enabled, you are out of
luck. MoreLikeThis works by executing two actions: first, a get request on
the given document, fetching a stored field content for the likeText search
query (falling ack to _source if no fields are specified), then populating
the parameters before executing a generated search as the second action.

Best regards,

Jörg

--