-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
Description
May be not a so good idea but in my use case, I'd like to be able to do different kind of elasticsearch lookups depending on the input event values.
Ideally, I'd like to write something like:
filter {
if [foo] {
mutate { add_field => { "template" => "search-by-foo.json" } }
} else {
mutate { add_field => { "template" => "search-by-bar.json" } }
}
elasticsearch {
query_template => "%{[template]}"
remove_field => ["template"]
}
}This is not supported yet as the elasticsearch filter checks at the pipeline creation time that %{[template]} file is available.
Would it be possible to support this?
Of course, I have a workaround but this makes me duplicate the elasticsearch filter twice:
filter {
if [foo] {
elasticsearch {
query_template => "search-by-foo.json"
}
} else {
elasticsearch {
query_template => "search-by-bar.json"
}
}
}It looks a nice workaround but when the elasticsearch filter configuration is more complex (more options), that's "a lot" of lines of code to duplicate. Here I have also only 2 type of searches but we can think about more than that as well.