How to add Alphabetical Sorting

Hi Team,

I am quite new in elastic search and trying to query a data where i need to add filters based on
fields where sorting will also be there which will be in A-Z / Z-A sorting.

here is the request
"query": {
"bool": {
"must": [
{"match_phrase": {"categories_filter": "hollywood"}},
{"match_phrase": {"sub_categories_filter": "Sub-Category 7"} },
------ Want to add sorting here--------------


Please format your code.

Are you searching for this?

Thanks for the reply David,

if i can tell you in mysql query, my data will be fetched like below given query

select * from movies where categories_filter='hollywood' AND
sub_categories_filter='sub-category7' AND genre='Drama' and so on ORDER BY (A-Z / Z-A) DESC...SO the whole set of record come in alphabetically ordered.

Kindly let me know if your given URL will work as per my requirement.

Yes it will. Just give it a try. It's super easy to start with elasticsearch.

Thanks Alot.. I will try now and will let u know about the outcome...Thanks again

Hi David,

So here is the issue which I am facing right now, which is having 'AND' search as given below example..

Suppose I have selected

  1. Category - Hollywood
  2. Sub-Category - Bond Special
  3. Genre - Action & Drama & Comedy ( as multiple selection will be there )
  4. Language - English, Russian and Hindi ( as multiple selection will be there)
  5. Release Year - 1990,1999,2000 ( as multiple selection will be there)
  6. 3D Movie - True OR False (any one will be selected)
    and in last
  7. SortBy - “A-Z”OR “Z-A” OR “Date”

Can you help me in making this bulk query for elastic-search. I will use "match_phrase" for making AND condition but the issue is matching parameters are multiple and will be in comma separated (u can say).