Alphabetically sort name field

I have the following definition for the name field

"name": {
  "type": "text",
  "fields": {
    "keyword": {
      "type": "keyword",
      "ignore_above": 256
    }
  }
},

How do i sort this alphabetically ?

I am trying the following

{
  "query": {
    "match": {
      "name": "Shoes"
    }
  },
  "sort": {
    "keyword": {
       "order": "asc"
    }  
  },
  "size": 10,
  "from": 0,
  "sort": []
}

But the sort somehow does't seem to be doing anything at all.

Welcome to our community! :smiley:

Shouldn't the sort be on name.keyword?

yes thanks :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.