- Version: 7.3
 - Operating System: Windows 10
 - Config File (if you have sensitive info, please remove it):
filter {mutate {
add_field => {
"[@metadata][ingestInto]" => "${INGEST_INTO:true}"
}
} 
}
output {
file {
    path => "test.json"
    write_behavior => overwrite
}
**if [@metadata][ingestInto] != "true" {** 
    http {
            http_method => "post"
            url => "XXXXX"
            format => "message"
            headers => {"Content-Type" => "application/json"}
            content_type => "application/json"
            message => '%{message}'
            pool_max => 100
            pool_max_per_route => 100
    }
}
**else if [@metadata][ingestInto] != "false" {**
    elasticsearch {
        hosts => "${ES_HTTP_HOSTS}"
        index => "itoa1"
        document_id => "%{key}"
        document_type => "data"
    }       
}
}
- Sample Data:
else if [@metadata][ingestInto] != "false" or true , always it trying to push data to elastic.