My use-case : Before the document is indexed, I would like to Skip the documents with conditions using a script processor (defined in a pipeline). When I try to create a index using the pipeline with the script processor a null-pointer exception is thrown. Any pointers would be of great help.
Created a pipeline with script processor
PUT _ingest/pipeline/testindex
{
"description": "pipeline for filters",
"processors": [
{
"script": {
"on_failure": [
{
"fail": {
"message": "failed to parse"
}
}
],
"source": "ctx.actor_id = ( (java.lang.Double.parseDouble(ctx.actor_id+'') < java.lang.Double.parseDouble(3+''))) ? ctx.actor_id:Exception()",
"lang": "painless"
}
}
]
}
I get a error as below
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"processor_type": "script",
"script_stack": [
"... ? ctx.actor_id:Exception()",
" ^---- HERE"
],
"script": "ctx.actor_id = ( (java.lang.Double.parseDouble(ctx.actor_id+'') < java.lang.Double.parseDouble(3+''))) ? ctx.actor_id:Exception()",
"lang": "painless"
}
],
"type": "script_exception",
"reason": "compile error",
"processor_type": "script",
"script_stack": [
"... ? ctx.actor_id:Exception()",
" ^---- HERE"
],
"script": "ctx.actor_id = ( (java.lang.Double.parseDouble(ctx.actor_id+'') < java.lang.Double.parseDouble(3+''))) ? ctx.actor_id:Exception()",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "invalid sequence of tokens near ['('].",
"caused_by": {
"type": "no_viable_alt_exception",
"reason": null
}
}
},
"status": 400
}
I am using elasticsearch 7.4.2
I tried drop processor but i am facing issue for Date parsing.