php - Sorting in Elastic Search by defined type -
i have request elastic service.
url callback is:
get /es-main/project,projectstage,task,taskcomment,ticketcomment,client,user,attachment/_search
how add sort improvement requirements results in sequence embedded in url + score? alphabetically type. example first type project, second projectstage, etc...
thanks answers...
get /es-main/project,projectstage,task,taskcomment,ticketcomment,client,user,attachment/_search array ( [query] => array ( [query_string] => array ( [query] => *a* [analyzer] => hunspell_cs [fields] => array ( [0] => name [1] => description [2] => tags.name [3] => text [4] => email [5] => filename ) ) ) [from] => 0 [size] => 10 [sort] => array ( [_type] => asc [_score] => desc ) [aggs] => array ( [countbytype] => array ( [terms] => array ( [field] => _type ) ) ) )
okey, have added in document _is_project = 1, _is_projectstage = ,_is_task = 1, etc... , set ordering to:
order: { '_is_project': {'unmapped_type': 'long'}, // first '_is_projectstage': {'unmapped_type': 'long'}, // second '_is_task': {'unmapped_type': 'long'}, // third - etc... '_score': 'desc' }
Comments
Post a Comment