I am new at this, and not sure if it is doable. I am trying to set an array, then validate a field value (whether its exists in my array) all in one, or 2 separate scripted field.
here is what I have, and what I am trying to do:
I have this and it works, but it feels redundant:
sc-test
if (
doc['somefield.keyword'].value =~ /valueA/ ||
doc['somefield.keyword'].value =~ /valueB/ ||
doc['somefield.keyword'].value =~ /valueC/
) {
return "invalid PN"
} else {
return "valid PN"
}
This is what I am looking to achieve:
sc-list
“ValueA,ValueB,ValueC”
sc-test
if (
doc['somefield.keyword'].value =~ doc['sc-list'].value
) {
return "invalid"
} else {
return "valid"
}
or plugin the array on the same sc-test:
list = [ValueA,ValueB,ValueC]
if (
doc['somefield.keyword'].value =~ list
) {
return "invalid"
} else {
return "valid"
}
ERROR: Courier Fetch: 5 of 5 shards failed.