# Create Empty array when logstash outputs

**URL:** <https://discuss.elastic.co/t/create-empty-array-when-logstash-outputs/239005>\
**Category:** Logstash\
**Created:** [June 28, 2020, 12:10pm UTC](https://discuss.elastic.co/t/create-empty-array-when-logstash-outputs/239005 "2020-06-28T12:10:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![recordable542](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/recordable542/32/69082_2.png) [@recordable542](https://discuss.elastic.co/u/recordable542)\
**Post date:** [June 28, 2020, 12:10pm UTC](https://discuss.elastic.co/t/create-empty-array-when-logstash-outputs/239005/1 "2020-06-28T12:10:49Z")

</div>

```auto
input {
    jdbc {
        jdbc_driver_library => "..."
        jdbc_driver_class => "com.mysql.jdbc.Driver"
        jdbc_paging_enabled => true
        tracking_column => "unix_ts_in_secs"
        use_column_value => true
        tracking_column_type => "numeric"
        schedule => "* * * * *" 
        statement => "SELECT id, name, sex, animal_id, UNIX_TIMESTAMP(el_time) AS unix_ts_in_secs FROM users
        WHERE (UNIX_TIMESTAMP(el_time) > :sql_last_value AND el_time < NOW())
        ORDER BY el_time ASC"
    }
}

filter {
    mutate {
        copy => {
            ...
        }
        remove_field => ["..."]
        add_field => { "previous_matches" => "[]" }
    }
}

output {
    elasticsearch {
        hosts => ["localhost:9200"]
        index => "..."
        document_id => "%{[@metadata][_id]}"
    }
    stdout {
        codec => "rubydebug"
    }
}

```

## What I want to do

I would like to create a empty array (field'previous\_matches') when logstash outputs to elasticsearch

## What is actually happening

Seems like elasticsearch interprets field "previous\_matches" as string!

---

<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:** [July 26, 2020, 12:10pm UTC](https://discuss.elastic.co/t/create-empty-array-when-logstash-outputs/239005/2 "2020-07-26T12:10:54Z")

</div>

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