More like this with filters

Hi!

We've started to migrate to the new Elasticsearch 5, so some queries need an overhaul. We use more like this to find similar images. However, we need to filter the results, so only released images are shown. Before we could specify a filter claus like this:

 "filter": {
            "and": [
                   {
                    "term": {
                        "status": "released"
                    }
                },
                {
                    "terms": {
                        "execution": "or",
                        "media_type": [
                            "image"
                        ]
                    }
                }
            ]
        },
        "query": {
            "more_like_this": {
                "fields": [
                    "en_keyword",
                ],
                "like_text": "domestic animal domestic animals pet pets cats animals black and white cat animal monochrome domestic",
                "max_query_terms": 30,
                "min_term_freq": 1
            }
        }
}

How would we go about doing something similar these days?

Best regards, Jesper.

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