# HTTP Filter With Array

**URL:** https://discuss.elastic.co/t/http-filter-with-array/191306
**Category:** Logstash
**Created:** [July 19, 2019, 3:19am UTC](https://discuss.elastic.co/t/http-filter-with-array/191306 "2019-07-19T03:19:56Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)
#### Post date: [July 19, 2019, 3:19am UTC](https://discuss.elastic.co/t/http-filter-with-array/191306/1 "2019-07-19T03:19:56Z")

</div>

I have a field, `assigned_to_current`, that occasionally contains an array of values. I want to pass each of these values to the HTTP filter and then have it replace each value with the http result value. I guess like the translate filter...but with an API call. Below is what I am doing with the field and it works great with single values. How can I adapt this to work with a field that may contain an array of values?

```auto
  if [assigned_to_current] and [assigned_to_current] != "" and [assigned_to_current] != "guest" {
    http {
      headers => {
        "Authorization" => "12345"
        "Content-Type" => "application/json"
      }
      verb => "GET"
      url => "https://example.com/api/sys_user/%{[assigned_to_current]}"
      target_body => assigned_to_lookup
    }
    mutate { replace => { "assigned_to_current" => "%{[assigned_to_lookup][result][user_name]}" } }
  }
  else if ![assigned_to_current] or [assigned_to_current] == "" { mutate { replace => { "assigned_to_current" => "unassigned" } } }

```

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [July 19, 2019, 1:05pm UTC](https://discuss.elastic.co/t/http-filter-with-array/191306/2 "2019-07-19T13:05:49Z")

</div>

> [@wwalker](#):
>
> How can I adapt this to work with a field that may contain an array of values?

If there is a very limited number of entries in the array you could duplicate the section and replace [assigned\_to\_current] with [assigned\_to\_current][0] in one duplicate and [assigned\_to\_current][1] in the other. Otherwise you could use a split filter to break the array into multiple events. Otherwise, use a ruby filter with .each and implement the HTTP call yourself.

---

<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: [August 16, 2019, 1:06pm UTC](https://discuss.elastic.co/t/http-filter-with-array/191306/3 "2019-08-16T13:06:06Z")

</div>

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