Searching for strings with Special characters in ElasticSearch Scripts

How do I escape special characters in Elastic Search Scripts?

For example: I need to search for a string like "{NY} Albany" or "{CA} San Diego" in my script below:

      "size": 0,
      "aggs": {
        "Test": {
          "terms": {
            "script": {
              "source": "if(doc['City'].value == '{NY} Albany'){return 1}"
            "size": 500000

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