# Query to return a result set bounded by a fixed number of zeros (no rainfall)

**URL:** <https://discuss.elastic.co/t/query-to-return-a-result-set-bounded-by-a-fixed-number-of-zeros-no-rainfall/264992>\
**Category:** Elasticsearch\
**Created:** [February 21, 2021, 4:33pm UTC](https://discuss.elastic.co/t/query-to-return-a-result-set-bounded-by-a-fixed-number-of-zeros-no-rainfall/264992 "2021-02-21T16:33:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosselton](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@rosselton](https://discuss.elastic.co/u/rosselton)\
**Post date:** [February 21, 2021, 4:33pm UTC](https://discuss.elastic.co/t/query-to-return-a-result-set-bounded-by-a-fixed-number-of-zeros-no-rainfall/264992/1 "2021-02-21T16:33:04Z")

</div>

I'm using ES to store rainfall data from a weather API that updates every 10 minutes. I'm trying to write a query to return a set of records where a spell of dry weather ( 30 consecutive rain values in the range of 0 to 0.2) is followed by rainfall ( values 0+) to the present time. I was hoping to use a regex, but my values are floats and the query errors.

I'm new to ElasticSearch and am hoping that someone can give me some guidance of how best to construct a query.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 22, 2021, 3:04am UTC](https://discuss.elastic.co/t/query-to-return-a-result-set-bounded-by-a-fixed-number-of-zeros-no-rainfall/264992/2 "2021-02-22T03:04:16Z")

</div>

Welcome to our community! 😃

What about doing it with a Watch, eg [examples/Alerting/Sample Watches/system\_fails\_to\_provide\_data at master · elastic/examples · GitHub](https://github.com/elastic/examples/tree/master/Alerting/Sample%20Watches/system_fails_to_provide_data)

---

<div class="post-metadata">

**Author:** ![rosselton](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@rosselton](https://discuss.elastic.co/u/rosselton)\
**Post date:** [February 22, 2021, 3:27pm UTC](https://discuss.elastic.co/t/query-to-return-a-result-set-bounded-by-a-fixed-number-of-zeros-no-rainfall/264992/3 "2021-02-22T15:27:46Z")

</div>

Thanks Mark for the GitHub link! I'll read up on the ES docs as well about Watches.

Cheers  
Rebecca

---

<div class="post-metadata">

**Author:** ![rosselton](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@rosselton](https://discuss.elastic.co/u/rosselton)\
**Post date:** [February 23, 2021, 9:03am UTC](https://discuss.elastic.co/t/query-to-return-a-result-set-bounded-by-a-fixed-number-of-zeros-no-rainfall/264992/4 "2021-02-23T09:03:05Z")

</div>

Hi Mark, using a Watcher requires a non basic licence. I'm developing a product for research and community use and need to avoid unnecessary costs. Could you suggest another solution?

Many thanks  
Rebecca

---

<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:** [March 23, 2021, 9:03am UTC](https://discuss.elastic.co/t/query-to-return-a-result-set-bounded-by-a-fixed-number-of-zeros-no-rainfall/264992/5 "2021-03-23T09:03:18Z")

</div>

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