# Filebeat Dynamic matching key field

**URL:** <https://discuss.elastic.co/t/filebeat-dynamic-matching-key-field/164919>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 20, 2019, 2:22am UTC](https://discuss.elastic.co/t/filebeat-dynamic-matching-key-field/164919 "2019-01-20T02:22:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fengxiaoH](https://avatars.discourse-cdn.com/v4/letter/f/a5b964/32.png) [@fengxiaoH](https://discuss.elastic.co/u/fengxiaoH)\
**Post date:** [January 20, 2019, 2:22am UTC](https://discuss.elastic.co/t/filebeat-dynamic-matching-key-field/164919/1 "2019-01-20T02:22:54Z")

</div>

My configuration：

```auto
## The input config
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /data/logs_backup/baccarat/gate/gate.log
  fields:
    document_type: baccarat_gatelog
  fields_under_root: true

- type: log
  enabled: true
  paths:
    - /data/logs_backup/baccarat/room/room.log
  fields:
    document_type: baccarat_roomlog
  fields_under_root: true
## And Output config
#-------------------------- Redis output ------------------------------
output.redis:
    hosts: ["127.0.0.1"]
    port: 6379
    datatype: list
    keys:
      - key: "baccarat_gate"
        when.contains:
         document_type: "baccarat_gatelog"
      - key: "baccarat_room"
        when.contains:
          document_type: "baccarat_roomlog"

```

When i use 【keys】field，filebeat start failed。And when comment out the configuration for keys,filebeat start OK!  
Can someone tell me what error for my config?Must need 【mappings】field？  
Thanks!

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [January 22, 2019, 11:37am UTC](https://discuss.elastic.co/t/filebeat-dynamic-matching-key-field/164919/2 "2019-01-22T11:37:06Z")

</div>

Please format config files and logs using the `</>` button in the editor window.

What is the actual error message you are seeing.

---

<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:** [February 19, 2019, 11:42am UTC](https://discuss.elastic.co/t/filebeat-dynamic-matching-key-field/164919/3 "2019-02-19T11:42:17Z")

</div>

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