# Painless script - counting equal values in a field

**URL:** https://discuss.elastic.co/t/painless-script-counting-equal-values-in-a-field/316252
**Category:** Elasticsearch
**Tags:** painless
**Created:** [October 10, 2022, 6:06pm UTC](https://discuss.elastic.co/t/painless-script-counting-equal-values-in-a-field/316252 "2022-10-10T18:06:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Aleksei](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@Aleksei](https://discuss.elastic.co/u/Aleksei)
#### Post date: [October 10, 2022, 6:06pm UTC](https://discuss.elastic.co/t/painless-script-counting-equal-values-in-a-field/316252/1 "2022-10-10T18:06:31Z")

</div>

Hi.

I'm not good with pineless syntax.  
Please tell me by painless script.  
How to count the same values in a field ?  
For example, in the **field 1 = 111** three times.  
How to count duplicates ?

---

<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 7, 2022, 6:06pm UTC](https://discuss.elastic.co/t/painless-script-counting-equal-values-in-a-field/316252/2 "2022-11-07T18:06:36Z")

</div>

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