# Cant understand example from documentation

**URL:** <https://discuss.elastic.co/t/cant-understand-example-from-documentation/218937>\
**Category:** Elasticsearch\
**Created:** [February 12, 2020, 9:57am UTC](https://discuss.elastic.co/t/cant-understand-example-from-documentation/218937 "2020-02-12T09:57:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![linuxfan84](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/linuxfan84/32/62540_2.png) [@linuxfan84](https://discuss.elastic.co/u/linuxfan84)\
**Post date:** [February 12, 2020, 9:57am UTC](https://discuss.elastic.co/t/cant-understand-example-from-documentation/218937/1 "2020-02-12T09:57:42Z")

</div>

Hi all.  
I am studying Elasticsearch and I really like it. But I cant inderstand following example from documentation (From here - [https://www.elastic.co/guide/en/elasticsearch/reference/7.2/query-dsl-intervals-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.2/query-dsl-intervals-query.html))  
POST \_search  
{  
"query": {  
"intervals" : {  
"my\_text" : {  
"match" : {  
"query" : "hot porridge",  
"filter" : {  
"script" : {  
"source" : "interval.start \> 10 && interval.end \< 20 && interval.gaps == 0"  
}  
}  
}  
}  
}  
}  
}

Can somebody explain what the interval is ? Where did the start, end and gaps methods come from ? I reviewed painless documentation but not found any interesting regading this. Could you please simply explain me what this example does and give some similar examples.  
Thank you in advance for your time

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 12, 2020, 4:19pm UTC](https://discuss.elastic.co/t/cant-understand-example-from-documentation/218937/2 "2020-02-12T16:19:21Z")

</div>

That is a so called `interval` script context, that does not seem to be documented at [https://www.elastic.co/guide/en/elasticsearch/painless/7.5/painless-filter-context.html](https://www.elastic.co/guide/en/elasticsearch/painless/7.5/painless-filter-context.html). Feel free to open a github issue about that.

This variable only exists, when scripts are called as part of the intervals query.

---

<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 11, 2020, 4:19pm UTC](https://discuss.elastic.co/t/cant-understand-example-from-documentation/218937/3 "2020-03-11T16:19:28Z")

</div>

Closed on March 11, 2020, 4:19pm UTC

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