Hi,
I am having trouble to dynamically add integer range (https://www.elastic.co/guide/en/elasticsearch/reference/current/range.html) to a field dynamically when I am reindexing to a new Elasticsearch cluster.
I have a new field mapping as follows
"pageno_range": {
"type": "integer_range",
"boost": 4
},
"pageno": {
"type": "keyword",
"boost": 4
}
so When I am trying to reindex for an index , I want to add integer range dynamically to the pageno_range field.The script part for the reindexing are as follows
"script": {
"lang": "painless",
"source": "ctx._source.type = params.index_type;ctx._routing = params.index_route + ctx._source.year;if (ctx._source.pageno ==~ /\\d+/) { ctx._source.pageno_range = params.pageno_range_obj }",
"params": {
"index_route": "es_mag-",
"index_type" : "mag",
"greater_than" : "gte",
"less_than" : "lte",
"pageno_range_obj": {
"gte" : "ctx._source.pageno",
"lte" : "ctx._source.pageno"
}
}
}
But I am not able to dynamically insert into the pageno_range field.
I am getting the below issue :
Please suggest me how I can dynamically insert the pageno_range value for "gte" and "lte" with the pageno field.
Is it possible to dynamically add value to the params tag for the script?
Please guys need some help and suggestion.