Unable to set a boolean plugin property dynamically

Hi, there's an open issue for this in logstash-output-elasticsearch github (here) but i think it is not a specific plugin bug but logstash bug.

In short: if i want to set a boolean property dynamically, i cannot. if i configure my plugin with this:

output{
        elasticsearch {
                doc_as_upsert => "%{[@metadata][doc_as_upsert]}"
        }
}

it will complain for string to boolean assignment, and if i configure my plugin with this:

output{
        elasticsearch {
                doc_as_upsert => [@metadata][doc_as_upsert]
        }
}

it gets parsing error. as the parser probably comes from logstash and not from each plugin, i think it is more suitable to open the bug in the logstash level.

This isn't a generic problem. By design not all options support sprintf interpolations. In many cases it's an oversight but there are cases when the option value can't be dynamic (or it would be too expensive to make it dynamic).

Thanks for the quick response. In this case its not really expensive to make it dynamic as this flag is simply sent to the http request sent to elastic search. All other fields like index and routing are also dynamic. What is your opinion on solving this? Can this be solved on the plugin level without breaking changes like changing the property to be a string value?

I don't think it would be difficult to fix. It's definitely a plugin-level change.

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