Problems with getting/checking map value by given key in painless script

I experience problems with getting/checking map value by given key in painless script.
Examples:

GET tt/clip/_search
{
  "query": {
    "function_score": {
      "script_score": {
        "script": {
          "lang": "painless",
          "source":  "def params_map=['title_tfidf':'title_tfidf','full_text_tfidf':'full_text_tfidf','ocr_tfidf':'text_tfidf','clips_ccs_tfidf':'text_tfidf','plot_tfidf':'text_tfidf'];Debug.explain(params_map['title_tfidf']);"
        }
      }
    }
  }
}

Results in

{
  "error": {
    "root_cause": [
      {
        "type": "script_exception",
        "reason": "runtime error",
        "painless_class": "String",
        "to_string": "title_tfidf",
        "java_class": "java.lang.String",
        "script_stack": [
          "Debug.explain(params_map['title_tfidf']);",
          "                        ^---- HERE"
        ],
        "script": "def params_map=['title_tfidf':'title_tfidf','full_text_tfidf':'full_text_tfidf','ocr_tfidf':'text_tfidf','clips_ccs_tfidf':'text_tfidf','plot_tfidf':'text_tfidf'];Debug.explain(params_map['title_tfidf']);",
        "lang": "painless"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "tt_1.88",
        "node": "KB6gGqOMQwm3zMqUzBJW0w",
        "reason": {
          "type": "script_exception",
          "reason": "runtime error",
          "painless_class": "String",
          "to_string": "title_tfidf",
          "java_class": "java.lang.String",
          "script_stack": [
            "Debug.explain(params_map['title_tfidf']);",
            "                        ^---- HERE"
          ],
          "script": "def params_map=['title_tfidf':'title_tfidf','full_text_tfidf':'full_text_tfidf','ocr_tfidf':'text_tfidf','clips_ccs_tfidf':'text_tfidf','plot_tfidf':'text_tfidf'];Debug.explain(params_map['title_tfidf']);",
          "lang": "painless",
          "caused_by": {
            "type": "painless_explain_error",
            "reason": null
          }
        }
      }
    ]
  },
  "status": 500
}

The same result with

GET tt/clip/_search
{
  "query": {
    "function_score": {
      "script_score": {
        "script": {
          "lang": "painless",
          "source":  "def params_map=['title_tfidf':'title_tfidf','full_text_tfidf':'full_text_tfidf','ocr_tfidf':'text_tfidf','clips_ccs_tfidf':'text_tfidf','plot_tfidf':'text_tfidf'];Debug.explain(params_map.get('title_tfidf'));"
        }
      }
    }
  }
}

Closing the question. The problem is found

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