Here is a part of my query:
must_not: {
script: {
script: {
source: "doc['type.keyword'].value=='CHANNEL' ? doc['id'].value == 0 : ['1','3','7'].contains(doc['id'].value"),
lang: 'painless'
}
}
}
How can I check if doc['id'].value
has a value from an array?
rjernst
(Ryan Ernst)
December 20, 2018, 8:12pm
2
What type is your id
field (in your mappings)?
I've tried different ways:
source:"doc['type.keyword'].value=='CHANNEL' ? doc['id'].value == 0 : params.ids.values.contains(doc['id'].value)",
params: {
ids: [5,6]
} - NO ERROR. JUST NOT FILTERING
source:"doc['type.keyword'].value=='CHANNEL' ? doc['id'].value == 0 : params.ids.contains(doc['id'].value)",
params: {
ids: ['5','6']
} - NO ERROR. JUST NOT FILTERING
source:"doc['type.keyword'].value=='CHANNEL' ? doc['id'].value == 0 : for (el in params.ids) {doc['id'].value==el}",
params: {
ids: ['5','6']
} . ERROR
system
(system)
Closed
January 25, 2019, 11:31pm
5
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.