Applying analyzer in filter elasticsearch

Hello.
I am attempting to enrich my data with ES lookup when the URL appears in my log line.

if [url]{
elasticsearch {
hosts => ["localhost:9200"]
index => "url_lookup"
query_template => "/etc/logstash/conf.d/query_templates/url_matching.json"
fields => { "url" => "matched_url" }
}
}

my url_matching.json
{
"query": {
"query_string": {
"query": "url:%{[url]}"
}
}
}

In the URL we have a special characters that we need to escape:
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters

Is there a way to use analyzer to do that job for me in this use case?

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