How can I sort String with has_parent in ElasticSearch

I use has_parent for query data, but I want to sort this data follow some parent field which is a String .

I tried to find solutions, I found how to sort in ElasticSearch documents

"query": {
        "has_parent" : {
            "parent_type" : "blog",
            "score" : true,
            "query" : {
                "function_score" : {
                    "script_score": {
                        "script": "_score * doc['view_count'].value"
                    }
                }
            }
        }
    }

It use "score" * doc['view_count'] for searching which is an integer , but I want to do some calculations with String for searching it, but I don't know what should I do.

If you have another idea, please tell me.

thanks for helping me.

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