I have question with using nested pipeline
- distribution pipeline processor:
PUT _ingest/pipeline/pipeline_for_distribution
{
"description": "a pipeline for distribution",
"processors": [
{
"pipeline": {
"name": "pipeline_for_set",
"if": """
String tagss = ctx['tags'];
if (tagss.toLowerCase().contains('openstack')) {
return true;
}
return false;
"""
}
},
{
"pipeline": {
"name": "pipeline_for_split",
"if": """
String tagsx = ctx['tags'];
if (tagsx.toLowerCase().contains('hadoop')) {
return true;
}
return false;
"""
}
}
]
} - Nested pipeline processor
PUT _ingest/pipeline/pipeline_for_set
{
"description": "a pipeline for set",
"processors": [
{
"pipeline": {
"name": "pipeline_for_split"
}
}
]
} - Normal pipeline processor
PUT _ingest/pipeline/pipeline_for_split
{
"description": "a pipeline for split",
"processors": [
{
"split": {
"field": "tags",
"separator": ",",
"target_field": "tags_arr" //if no target_field set, will be failed
}
}
]
} - Test
POST _ingest/pipeline/_simulate
{
"pipeline": {
"description": "to split blog tags",
"processors": [
{
"pipeline": {
"name": "pipeline_for_distribution"
}
}
]
},
"docs": [
{
"_index": "index",
"_id": "idxx",
"_source": {
"title": "Introducing cloud computering",
"tags": "openstack,k8s",
"content": "You konw,for cloud"
}
}
]
} - Error
{
"docs" : [
{
"error" : {
"root_cause" : [
{
"type" : "exception",
"reason" : "java.lang.IllegalArgumentException: ScriptException[runtime error]; nested: ClassCastException[org.Elasticsearch.ingest.ConditionalProcessor$UnmodifiableIngestList cannot be cast to java.lang.String];",
"header" : {
"processor_type" : "conditional"
}
}
],
"type" : "exception",
"reason" : "java.lang.IllegalArgumentException: ScriptException[runtime error]; nested: ClassCastException[org.Elasticsearch.ingest.ConditionalProcessor$UnmodifiableIngestList cannot be cast to java.lang.String];",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "ScriptException[runtime error]; nested: ClassCastException[org.Elasticsearch.ingest.ConditionalProcessor$UnmodifiableIngestList cannot be cast to java.lang.String];",
"caused_by" : {
"type" : "script_exception",
"reason" : "runtime error",
"script_stack" : [
"""
tagsx = ctx['tags'];
""",
" ^---- HERE"
],
"script" : """
String tagsx = ctx['tags'];
if (tagsx.toLowerCase().contains('hadoop')) {
return true;
}
return false;
""",
"lang" : "painless",
"caused_by" : {
"type" : "class_cast_exception",
"reason" : "org.Elasticsearch.ingest.ConditionalProcessor$UnmodifiableIngestList cannot be cast to java.lang.String"
}
}
},
"header" : {
"processor_type" : "conditional"
}
}
}
]
}
Anyone can help me to explain this?