Data_target field is already available. just need to get it basis on Org_path field
I am trying to right a script .. if Org_path == ABC/XYZ then return data target else return data target where Org_path is not available
Pls provide some details about your use case, and if I follow your logic, if the data_target field is always available, there's no need to add a condition? since always the field value is returned? thx!
Yes, data_target will always be available.
Here what i am trying to do.
Suppose, I have dashboard for client A,B and C. which share same data_target.
but, client D will have different data_target. In ES I will have 2 entries.
for client A, B and C ( here I will not have Org_path field)
For client D ( here I will have "Org_path" : "client D" )
So I want to hit only one time to db.
Now on UI if i select client A , B or C from drop down then it should take generic value.
But when I select Client D then data_target value should change.
Sorry, I know this is very confusing.
I tried righting script in terms aggregation but Org_path is tree so I am getting error
GET target_data_new/_search
{
"size": 200,
"query": {
"match_all": {}
},
"aggs": {
"NAME": {
"terms": {
"script": {
"source": "doc['Org_path'].value == params.tz",
"params": {
"tz":"/client/D"
}
}
}
}
}
}
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.