# Thanks to everyone, but another question

**URL:** <https://discuss.elastic.co/t/thanks-to-everyone-but-another-question/112818>\
**Category:** Elasticsearch\
**Created:** [December 21, 2017, 12:17pm UTC](https://discuss.elastic.co/t/thanks-to-everyone-but-another-question/112818 "2017-12-21T12:17:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![negroan](https://avatars.discourse-cdn.com/v4/letter/n/c2a13f/32.png) [@negroan](https://discuss.elastic.co/u/negroan)\
**Post date:** [December 21, 2017, 12:17pm UTC](https://discuss.elastic.co/t/thanks-to-everyone-but-another-question/112818/1 "2017-12-21T12:17:51Z")

</div>

Hello, good day to everyone. reading documentation and doing tests I could get to do a mini aggregate but I would like to see if anyone can give me a hand with the following.  
This is my little script of which I have some doubts.

```auto
GET webservicesnet8 * / _ search
{
  "size": 0,
  "aggs": {
    "uriStem": {
      "terms": {"field": "uriStem.keyword"},
      "aggs": {
    "timetaken": {"avg": {"field": "timetaken"}
             }
           }
           
                  }
        }
      }
    }
  }

```

First of all the doubt that I have is how I could do so that the result conditioned to a period of dates.  
Second, since I need to graph it I would also like the result to be able to see the date regardless of hour minute seconds since the aggregate will be daily.  
Third do I have a way of making the result put in an index and mark them as a field?

I hope you can help me again.

Thank you so much.

regards

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [December 21, 2017, 2:18pm UTC](https://discuss.elastic.co/t/thanks-to-everyone-but-another-question/112818/2 "2017-12-21T14:18:11Z")

</div>

> [@negroan](#):
>
> how I could do so that the result conditioned to a period of dates

You need to add a `query` object on the same level as `aggs` that defines which documents you want to match.

> [@negroan](#):
>
> Second, since I need to graph it I would also like the result to be able to see the date regardless of hour minute seconds since the aggregate will be daily.

Sorry I don't get the question.

> [@negroan](#):
>
> Third do I have a way of making the result put in an index and mark them as a field?

Not automatically. You can do this kind of things, but manually from the client-side.

---

<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:** [January 18, 2018, 2:18pm UTC](https://discuss.elastic.co/t/thanks-to-everyone-but-another-question/112818/3 "2018-01-18T14:18:14Z")

</div>

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