# Watcher, how to create and compare arrays

**URL:** <https://discuss.elastic.co/t/watcher-how-to-create-and-compare-arrays/315597>\
**Category:** Elasticsearch\
**Created:** [September 30, 2022, 4:46pm UTC](https://discuss.elastic.co/t/watcher-how-to-create-and-compare-arrays/315597 "2022-09-30T16:46:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sguerrero](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@sguerrero](https://discuss.elastic.co/u/sguerrero)\
**Post date:** [September 30, 2022, 4:46pm UTC](https://discuss.elastic.co/t/watcher-how-to-create-and-compare-arrays/315597/1 "2022-09-30T16:46:14Z")

</div>

Hi. We're trying to perform an alarm with a watcher alarm but we don't know how.

We have two different indices, index-1 and index-2, we need to search all events of index-1 and find all unique values of a field called field-x.  
We need to search all events of index-2 and find all unique values of a field called field-y.  
And then we have to compare these two arrays, and if they are different, we need to alarm and show the different values.

Can you help us with it?

Thank you, kind regards.

---

<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:** [October 28, 2022, 4:46pm UTC](https://discuss.elastic.co/t/watcher-how-to-create-and-compare-arrays/315597/2 "2022-10-28T16:46:15Z")

</div>

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