Sort Alphabetically Ignoring Numbers & Special Characters

How to sort a text field alphabetically, ignoring the special characters & numbers? By default, the special characters come first followed by numbers and alphabets.

What I need is alphabets should be sorted and appear first, followed by numbers and special characters. Is that even possible in ES 6.3?

I've tried with the custom analyzer to replace all non-alphabetical characters but it didn't work:

{
  "analysis": {
    "analyzer": {
      "alphabets_analyzer": {
        "tokenizer": "standard",
        "type": "keyword",
        "char_filter": [
          "alphabets_char_filter"
        ]
      }
    },
    "char_filter": {
      "alphabets_char_filter": {
        "type": "pattern_replace",
        "pattern": "[^a-zA-Z\\s\\.]",
        "replacement": ""
      }
    }
  }
}

Consider adding a field, consisting of the stripped values, at index time instead. Then just sort by that field as you normally would. It would be a much more simple setup, and better performing.

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