Cannot execute scripts using [field] context

Dear Team

When i want to add a new script field by kibana management menu, i got a error, i find the request is looks like this:

    path: elasticsearch/_msearch
    request payload: {"index":"myIndex","ignore_unavailable":true}
    {"query":{"match_all":{}},"script_fields":{"testName":{"script":{"lang":"painless","source":"1000 * 
    2"}}},"size":10,"timeout":"30s"}
    response: {"took":242,"responses":[{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"cannot execute scripts using [field] context"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"myIndex","node":"R4pys3T1TrmkqweO888IYQ","reason":{"type":"illegal_argument_exception","reason":"cannot execute scripts using [field] context"}}],"caused_by":{"type":"illegal_argument_exception","reason":"cannot execute scripts using [field] context","caused_by":{"type":"illegal_argument_exception","reason":"cannot execute scripts using [field] context"}}},"status":400}]}
response: {"took":242,"responses":[{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"cannot execute scripts using [field] context"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"myIndex
","node":"R4pys3T1TrmkqweO888IYQ","reason":{"type":"illegal_argument_exception","reason":"cannot execute scripts using [field] context"}}],"caused_by":{"type":"illegal_argument_exception","reason":"cannot execute scripts using [field] context","caused_by":{"type":"illegal_argument_exception","reason":"cannot execute scripts using [field] context"}}},"status":400}]}

so i donot konw what is mean, how can i fix it?

kibana version: 7.3.1

What is the script you are trying to use?

i have used so many script just like

"2"
"doc['json.a'].value - doc['json.b'].value"

all got the same error

It looks like your index pattern is for myIndex. Is that actually matching an index?

GET myIndex/_stats

Yes, the index pattern is real, i can use that create visualization, query data.
just cannot create script field.
I have so many index pattern, every one got same error

this is part of my index stats, myIndex is a alias,do u need more info?

{
  "_shards" : {
"total" : 2,
"successful" : 2,
"failed" : 0
  },
  "_all" : {
"primaries" : {
  "docs" : {
    "count" : 12981469,
    "deleted" : 1810
  },
  "store" : {
    "size_in_bytes" : 39275771839
  },
  "indexing" : {
    "index_total" : 13001345,
    "index_time_in_millis" : 5498910,
    "index_current" : 0,
    "index_failed" : 0,
    "delete_total" : 0,
    "delete_time_in_millis" : 0,
    "delete_current" : 0,
    "noop_update_total" : 0,
    "is_throttled" : false,
    "throttle_time_in_millis" : 0
  },
  "get" : {
    "total" : 0,
    "time_in_millis" : 0,
    "exists_total" : 0,
    "exists_time_in_millis" : 0,
    "missing_total" : 0,
    "missing_time_in_millis" : 0,
    "current" : 0
  },
  "search" : {
    "open_contexts" : 0,
    "query_total" : 1072,
    "query_time_in_millis" : 271182,
    "query_current" : 0,
    "fetch_total" : 1000,
    "fetch_time_in_millis" : 41979,
    "fetch_current" : 0,
    "scroll_total" : 0,
    "scroll_time_in_millis" : 0,
    "scroll_current" : 0,
    "suggest_total" : 0,
    "suggest_time_in_millis" : 0,
    "suggest_current" : 0
  },
  "merges" : {
    "current" : 0,
    "current_docs" : 0,
    "current_size_in_bytes" : 0,
    "total" : 85,
    "total_time_in_millis" : 11307738,
    "total_docs" : 16501215,
    "total_size_in_bytes" : 49977280946,
    "total_stopped_time_in_millis" : 0,
    "total_throttled_time_in_millis" : 8556280,
    "total_auto_throttle_in_bytes" : 5242880
  },
  "refresh" : {
    "total" : 874,
    "total_time_in_millis" : 658285,
    "external_total" : 710,
    "external_total_time_in_millis" : 164904,
    "listeners" : 0
  },
  "flush" : {
    "total" : 109,
    "periodic" : 109,
    "total_time_in_millis" : 788401
  },
  "warmer" : {
    "current" : 0,
    "total" : 709,
    "total_time_in_millis" : 23
  },
  "query_cache" : {
    "memory_size_in_bytes" : 19381811,
    "total_count" : 28568,
    "hit_count" : 5644,
    "miss_count" : 22924,
    "cache_size" : 486,
    "cache_count" : 804,
    "evictions" : 318
  },
  "fielddata" : {
    "memory_size_in_bytes" : 0,
    "evictions" : 0
  },
  "completion" : {
    "size_in_bytes" : 0
  },
  "segments" : {
    "count" : 41,
    "memory_in_bytes" : 17642230,
    "terms_memory_in_bytes" : 3574060,
    "stored_fields_memory_in_bytes" : 9638304,
    "term_vectors_memory_in_bytes" : 0,
    "norms_memory_in_bytes" : 114304,
    "points_memory_in_bytes" : 3754990,
    "doc_values_memory_in_bytes" : 560572,
    "index_writer_memory_in_bytes" : 9407668,
    "version_map_memory_in_bytes" : 41952,
    "fixed_bit_set_memory_in_bytes" : 0,
    "max_unsafe_auto_id_timestamp" : -1,
    "file_sizes" : { }
  },
  "translog" : {
    "operations" : 81017,
    "size_in_bytes" : 563006998,
    "uncommitted_operations" : 43282,
    "uncommitted_size_in_bytes" : 299094397,
    "earliest_last_modified_age" : 0
  },
  "request_cache" : {
    "memory_size_in_bytes" : 0,
    "evictions" : 0,
    "hit_count" : 110,
    "miss_count" : 834
  },
  "recovery" : {
    "current_as_source" : 0,
    "current_as_target" : 0,
    "throttle_time_in_millis" : 0
  }
},
"total" : {
  "docs" : {
    "count" : 25962938,
    "deleted" : 3496
  },
  "store" : {
    "size_in_bytes" : 78545553657
  },
  "indexing" : {
    "index_total" : 26002680,
    "index_time_in_millis" : 10888521,
    "index_current" : 0,
    "index_failed" : 0,
    "delete_total" : 0,
    "delete_time_in_millis" : 0,
    "delete_current" : 0,
    "noop_update_total" : 0,
    "is_throttled" : false,
    "throttle_time_in_millis" : 0
  },
  "get" : {
    "total" : 0,
    "time_in_millis" : 0,
    "exists_total" : 0,
    "exists_time_in_millis" : 0,
    "missing_total" : 0,
    "missing_time_in_millis" : 0,
    "current" : 0
  },
  "search" : {
    "open_contexts" : 0,
    "query_total" : 1865,
    "query_time_in_millis" : 477438,
    "query_current" : 0,
    "fetch_total" : 1705,
    "fetch_time_in_millis" : 91439,
    "fetch_current" : 0,
    "scroll_total" : 0,
    "scroll_time_in_millis" : 0,
    "scroll_current" : 0,
    "suggest_total" : 0,
    "suggest_time_in_millis" : 0,
    "suggest_current" : 0
  },
  "merges" : {
    "current" : 0,
    "current_docs" : 0,
    "current_size_in_bytes" : 0,
    "total" : 171,
    "total_time_in_millis" : 23086335,
    "total_docs" : 33933310,
    "total_size_in_bytes" : 102194024302,
    "total_stopped_time_in_millis" : 0,
    "total_throttled_time_in_millis" : 17566789,
    "total_auto_throttle_in_bytes" : 10485760
  },
  "refresh" : {
    "total" : 1757,
    "total_time_in_millis" : 1336357,
    "external_total" : 1429,
    "external_total_time_in_millis" : 382616,
    "listeners" : 0
  },
  "flush" : {
    "total" : 218,
    "periodic" : 218,
    "total_time_in_millis" : 1495407
  },
  "warmer" : {
    "current" : 0,
    "total" : 1427,
    "total_time_in_millis" : 43
  },
  "query_cache" : {
    "memory_size_in_bytes" : 35364713,
    "total_count" : 69318,
    "hit_count" : 10246,
    "miss_count" : 59072,
    "cache_size" : 667,
    "cache_count" : 1438,
    "evictions" : 771
  },
  "fielddata" : {
    "memory_size_in_bytes" : 0,
    "evictions" : 0
  },
  "completion" : {
    "size_in_bytes" : 0
  },

......
  }
}
  }
}

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