How to add scripted field to my custom endpoint?

hi team, my code is like :

	path: '/api/combineindexes',
	method: 'GET',
	handler(req, h) {
		const qqq = {
			index: "*index1,*index2",
			q: "rule_id:*",
			script_fields: {
				"my_field" : {
					"script" : {
						"lang": "painless",
						"source": "doc['rule_id'].value"
		callWithRequest(req, 'search', qqq)
		return h.response(callWithRequest);

but i receive error like

Unhandled rejection [illegal_argument_exception] request [/*alerts,*correlationsearches-lookup/_search] contains unrecognized parameter: [script_fields] -> did you mean any of [stored_fields, suggest_field, docvalue_fields]?

my task is to combine and transform fields from two indexes

What version of ElasticSearch/Kibana are you using?