# Compare values across two indicies

**URL:** <https://discuss.elastic.co/t/compare-values-across-two-indicies/346279>\
**Category:** Elasticsearch\
**Created:** [November 2, 2023, 10:31am UTC](https://discuss.elastic.co/t/compare-values-across-two-indicies/346279 "2023-11-02T10:31:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![krzychohoho](https://avatars.discourse-cdn.com/v4/letter/k/c68b51/32.png) [@krzychohoho](https://discuss.elastic.co/u/krzychohoho)\
**Post date:** [November 2, 2023, 10:31am UTC](https://discuss.elastic.co/t/compare-values-across-two-indicies/346279/1 "2023-11-02T10:31:21Z")

</div>

Hi, i want to compare two fields in two indexes in elasticsearch and return a hit if they match. For example:

```auto
Index1:
-hostname: "computer"

Index2:
-host_name: "computer"

```

If hostname value equals to host\_name value, I want it to return a hit.

The advanced version of this that i would like to achieve is:

```auto
Index1:
-hostname: "computer"
-last_seen: "13h"

Index2:
-host_name: "computer"

```

And return a hit if hostname=host\_name and last\_seen\>12h

I was looking for the answer for a very long time and just can't get the solution. I was trying to use the watcher, but i am using free and open license. If anyone could help me i woul really appreciate it.

Thank you in advance.

---

<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:** [November 30, 2023, 10:32am UTC](https://discuss.elastic.co/t/compare-values-across-two-indicies/346279/2 "2023-11-30T10:32:13Z")

</div>

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