I am trying to use the following Painless script query in one of my applications, but it does not seem to be working. Any problem with the syntax? I noticed that the part that does not really work is this Math.max(doc["level"].value, 1) - 1
. Please, note that "id" field is a keyword and "level" is a byte.
{script: {script: {
inline: 'doc["id"].value == params.parentDocIds[Math.max(doc["level"].value, 1) - 1]',
params: {parentDocIds: parentDocIds}
}}}
Thank you!