Elasticsearch order by type -
i'm searching index multiple types using 'http://es:9200/products/_search?q=sony'. return lot of hits many different types. hits array contains results not in order want to; want 'television' type show before rest. possible @ order type?
you can achieve sorting
on pre-defined field _type
. query below sorts results in ascending order of document types.
post <indexname>/_search { "sort": [ { "_type": { "order": "asc" } } ], "query": { <query goes here> } }
Comments
Post a Comment