Check if a field exists

I'm using nested fields and a field name in the nested field name, as you can see below (example) :


[doc][vegetables][%{[tmp_data][vegetable_name]}][number]

The field above is getting created, but now, I want in another filter (i'm updating existing documents) to check if the field exists. I tried to do things like :

  • if ([doc][vegetables][%{[tmp_data][vegetable_name]}][number]) {

  • if "[doc][vegetables][%{[tmp_data][vegetable_name]}][number]" {

  • if [doc][vegetables]["%{[tmp_data][vegetable_name]}"][number] {

What's the correct syntax ?

Thanks in advance.

There isn't one. You cannot use a sprintf reference in a conditional.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.