I am using the More like this query for getting the similarity between medical reports and then put them in a matrix. The problem is that somehow it is only giving me 10 results instead of all of them.
I guess it is giving me the 10 more similar?
We have tried putting a size field and nothing is working.
Also is there a way to show the results divided by the fields? Because I have read it mixes all the fields results to give a final score, but I would also like to get the individual ones
def search_similar (self, id_caso):
return self._es_buscar(
{
"size": 100,
"query": {
"more_like_this": {
"like": [ { "_id": id_caso} ],
"fields": self.conf.get('campos'),
"max_query_terms": 100,
"min_term_freq": 0,
"minimum_should_match": 0
}
}
})
def _es_buscar (self, query):
res = self._es.search(index="historiales",
doc_type="historial",
body=query)
return [{ 'id': r['_id'], 'doc': r['_source'], 'score' : r['_score']} for r in res['hits']['hits']]
I'm only getting 10 results when I'm expecting 32. I don't get why.
The
sizeneeds to be specified as a parameter to thesearchmethod not inside the query body: