Hey,
Thanks for your reply. I have tried your code but unfortunately it is not working and failing with error "No field found for [short_description.keyword] in mapping with types []"
I have also tried build_info.causes.short_description.keyword instead of short_description.keyword but same error.
The mapping is something like below
"build_info" : {
"properties" : {
"built_on" : {
"type" : "text",
"fields" : {
"raw" : {
"type" : "keyword"
}
}
},
"causes" : {
"type" : "nested",
"properties" : {
"cause_class" : {
"type" : "text",
"fields" : {
"raw" : {
"type" : "keyword"
}
}
},
"short_description" : {
"type" : "text"
}
}
}
Hey, Thanks much for reply but as i said it is not working with both and as for reference y mapping is as below:
The mapping is something like below
"build_info" : {
"properties" : {
"built_on" : {
"type" : "text",
"fields" : {
"raw" : {
"type" : "keyword"
}
}
},
"causes" : {
"type" : "nested",
"properties" : {
"cause_class" : {
"type" : "text",
"fields" : {
"raw" : {
"type" : "keyword"
}
}
},
"short_description" : {
"type" : "text"
}
}
}
Hi, I am able to run the code in scripted field and test it there but when i come back to discover tab and select respective index i see a red box with error message script
String str = params._source.build_info.causes[0]['short_description'];
Yes I did tried this
if(!(params._source.build_info.causes[0]['short_description']).empty){
return params._source.build_info.causes[0]['short_description'];
}
else{
return "Not Found"
}
But still same error.
It seems that some document dose not have build_info.causes so I tried
if(doc.containsKey('build_info.causes')){
params['_source']['build_info']['causes'][0]['short_description']
}
but this is giving null for all, even if there is value in causes.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.