Is sorting possible on search_as_you_type field

I have mapped my product/category titles to search_as_you_type fields. When I try to sort by those fields I get this error:

"error": {

        "root_cause": [

            {

                "type": "illegal_argument_exception",

                "reason": "Fielddata is not supported on field [name] of type [search_as_you_type]"

            }

        ],

You can't sort on such a filed.
You need to define a subfield of type keyword and sort on that one.

I tried creating a keyword subfield of search_as_you_type field but it would not stick, then I found a Github issue which proposes creating a text field with two subfields(search_as_you_type and keyword) and that seems to go with ES.
So this is my workaround for now, thanks.

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