# Problem updating logs using elasticsearch ouput

**URL:** <https://discuss.elastic.co/t/problem-updating-logs-using-elasticsearch-ouput/84947>\
**Category:** Logstash\
**Created:** [May 8, 2017, 2:52pm UTC](https://discuss.elastic.co/t/problem-updating-logs-using-elasticsearch-ouput/84947 "2017-05-08T14:52:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vittorio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vittorio/32/18171_2.png) [@Vittorio](https://discuss.elastic.co/u/Vittorio)\
**Post date:** [May 8, 2017, 2:52pm UTC](https://discuss.elastic.co/t/problem-updating-logs-using-elasticsearch-ouput/84947/1 "2017-05-08T14:52:32Z")

</div>

Hello everybody,

I'm not finding a solution to this problem:

using http\_poller as input plugin, an elasticsearch filter to match log and enrich with some data, output elastic search for update the log.

here's the configuration example:

```
input {
  http_poller {
    urls => {
      test1 => {
        url => "http://localhost:9200/dp_api-*/_search?q=myqueryAND-tags:enriched"
        method => get
      #auth => {
      # user => "AzureDiamond"
      # password => "hunter2"
      #}
      }
    }
    request_timeout => 60
    # Supports "cron", "every", "at" and "in" schedules by rufus scheduler
    schedule => { every => "1m"}
    codec => "plain"
  # A hash of request metadata info (timing, response headers, etc.) will be sent here
    #metadata_target => "http_poller_metadata"
    tags => ["to_enrich"]
  }
}

filter{
   json{
    source => "message"
    remove_field => ["message"]
  }

 split {
   field => "[hits][hits]"
 }

 mutate {
    remove_field => ["took", "@version", "timed_out", "_shards", "[hits][hits][_index]", "[hits][hits][_type]"]
  }

  if "to_enrich" in [tags]{
      elasticsearch { #prendo i dpapi logs
        hosts => "localhost:9200"
        index => "dp_api-*"
        query_template => "path/elastic-queries/matching-requestaw.json"
        fields => { "request" => "[hits][hits][_source][new_key_vittorio]" }
        add_tag => ["enriched"]
        remove_tag => ["to_enrich"]
      }
  }
}

output {
  stdout {
    codec => rubydebug
  }
  if "enriched" in [tags] {
    elasticsearch {
        hosts => "localhost:9200"
        index => "dp-api-%{+YYYY.MM.dd}"
        document_id => "%{[hits][hits][_source][@metadata][_id]}"
        parent => ""
        action => "update"
      }
  }
}

```

and is not working simply because (i think) elasticsearch doesn't want the json like this one, which has all the fields that comes from the search. As output I successfully enrich the log using the filter but then i'm not able to update in elasticsearch. Am i missing something?

is there a way to tell elasticsearch output to take the content of the `_source` field ?

thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 5, 2017, 3:05pm UTC](https://discuss.elastic.co/t/problem-updating-logs-using-elasticsearch-ouput/84947/2 "2017-06-05T15:05:13Z")

</div>

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