I'm building an autocomplete search with elasticsearch so I need to query 3 indexes posts, comments, authors. I have the following query:
{
"query":{
"query_string":{
"query":"something"
}
}
}
the call:
curl -X GET 'http://localhost:9200/posts,comments,authors/_search?pretty' -d '{
"query": {
"query_string": {
"query": "something"
}
}
}'
I need to sort the results by specific index fields, for example:
posts index has a field called comments_count, comments votes_count and authors posts_count. When comparing posts, then it should sort by comments_count, when comments then votes_count, when authors then posts_count.
It's possible to do something like that? I wouldn't like to merge the indexes into one because they indexes completely different documents.