# Query the list of changes for a keyword field

**URL:** https://discuss.elastic.co/t/query-the-list-of-changes-for-a-keyword-field/129912
**Category:** Elasticsearch
**Created:** [April 28, 2018, 9:49am UTC](https://discuss.elastic.co/t/query-the-list-of-changes-for-a-keyword-field/129912 "2018-04-28T09:49:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)
#### Post date: [April 28, 2018, 9:49am UTC](https://discuss.elastic.co/t/query-the-list-of-changes-for-a-keyword-field/129912/1 "2018-04-28T09:49:36Z")

</div>

I have a serie of documents like this:

| timestamp | CAR.keyword | ENGINE\_SERIAL\_NUMBER.keyword |
| --- | --- | --- |
| 20-02-2017 | CAR1 | A0001 |
| 20-02-2017 | CAR2 | B0001 |
| 21-02-2017 | CAR1 | A0001 |
| 21-02-2017 | CAR2 | B0001 |
| 22-02-2017 | CAR1 | A0001 |
| 22-02-2017 | CAR2 | B0002 |
| 23-02-2017 | CAR1 | A0001 |
| 23-02-2017 | CAR2 | B0002 |
| 24-02-2017 | CAR1 | A0002 |
| 24-02-2017 | CAR2 | B0002 |

As you can see,

1. the 22nd, the ENGINE\_SERIAL\_NUMBER of CAR2 has changed.
2. the 24th, the ENGINE\_SERIAL\_NUMBER of CAR1 has changed.

I'd like to query for those changes. Something to be able to identify:

> 22-02-2017 CAR2 replaced engine B0001 by B0002  
> 24-02-2017 CAR1 replaced engine A0001 by A0002

Is it possible and how?

---

<div class="post-metadata">

### Author: ![dao](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@dao](https://discuss.elastic.co/u/dao)
#### Post date: [May 6, 2018, 8:29am UTC](https://discuss.elastic.co/t/query-the-list-of-changes-for-a-keyword-field/129912/2 "2018-05-06T08:29:14Z")

</div>

Do you want I reformulate? maybe it is not clear enough

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 6, 2018, 9:53am UTC](https://discuss.elastic.co/t/query-the-list-of-changes-for-a-keyword-field/129912/3 "2018-05-06T09:53:29Z")

</div>

I don't think you can easily.

Apart doing a terms agg on car then a sub terms on engine serial number.

But it's not going to give you the exact result you are expecting.

---

<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: [June 3, 2018, 9:53am UTC](https://discuss.elastic.co/t/query-the-list-of-changes-for-a-keyword-field/129912/4 "2018-06-03T09:53:33Z")

</div>

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