# Can use multiple field in compare\_key?

**URL:** <https://discuss.elastic.co/t/can-use-multiple-field-in-compare-key/229883>\
**Category:** Kibana\
**Created:** [April 27, 2020, 1:30am UTC](https://discuss.elastic.co/t/can-use-multiple-field-in-compare-key/229883 "2020-04-27T01:30:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shilpa](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@shilpa](https://discuss.elastic.co/u/shilpa)\
**Post date:** [April 27, 2020, 1:30am UTC](https://discuss.elastic.co/t/can-use-multiple-field-in-compare-key/229883/1 "2020-04-27T01:30:16Z")

</div>

Two questions:

1. Does below elastalert rule is correct to get a cumulative data in "system.network.in.dropped"?
2. Can we use two fields in compare\_key? we tried but did not work means when have both fields then do not send a elastalert.  
Example,  
compare\_key: ["system.network.in.dropped OR "system.network.out.dropped"]

Using below code:  
name: Metricbeat - [Net]In/Out Network Packet Dropped  
type: change

es\_host: 10.1.1.20  
es\_port: 9200

index: metricbeat-\*

# How often ElastAlert will query elasticsearch

run\_every:  
minutes: 2

# ElastAlert will buffer results from the most recent

buffer\_time:  
minutes: 15

#bucket\_interval:

# minutes: 15

realert:  
minutes: 10

compare\_key: "system.network.in.dropped"

ignore\_null: true

query\_key: "system.network.name"  
doc\_type: \_doc

sync\_bucket\_interval: true

filter:

- query:  
query\_string:  
query: "metricset.name:network AND host.name:test124"
- query:  
query\_string:  
query: "system.network.in.dropped:(\>0) OR system.network.out.dropped:(\>0)"

---

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [April 27, 2020, 7:30pm UTC](https://discuss.elastic.co/t/can-use-multiple-field-in-compare-key/229883/2 "2020-04-27T19:30:03Z")

</div>

hi @shilpa,

this is probably the wrong forum for an ElastAlert question. The project is hosted here: [https://github.com/Yelp/elastalert/issues](https://github.com/Yelp/elastalert/issues)

---

<div class="post-metadata">

**Author:** ![shilpa](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@shilpa](https://discuss.elastic.co/u/shilpa)\
**Post date:** [April 27, 2020, 8:34pm UTC](https://discuss.elastic.co/t/can-use-multiple-field-in-compare-key/229883/3 "2020-04-27T20:34:20Z")

</div>

Thank you Thomas.

---

<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:** [May 25, 2020, 8:34pm UTC](https://discuss.elastic.co/t/can-use-multiple-field-in-compare-key/229883/4 "2020-05-25T20:34:22Z")

</div>

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