# Kibana Dashboard, Get the last 10 elements of a specific index ignoring the specified time-range

**URL:** https://discuss.elastic.co/t/kibana-dashboard-get-the-last-10-elements-of-a-specific-index-ignoring-the-specified-time-range/156835
**Category:** Kibana
**Created:** [November 15, 2018, 10:52am UTC](https://discuss.elastic.co/t/kibana-dashboard-get-the-last-10-elements-of-a-specific-index-ignoring-the-specified-time-range/156835 "2018-11-15T10:52:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![faustf](https://avatars.discourse-cdn.com/v4/letter/f/ebca7d/32.png) [@faustf](https://discuss.elastic.co/u/faustf)
#### Post date: [November 15, 2018, 10:52am UTC](https://discuss.elastic.co/t/kibana-dashboard-get-the-last-10-elements-of-a-specific-index-ignoring-the-specified-time-range/156835/1 "2018-11-15T10:52:09Z")

</div>

Hi Guys,

I've created my own Kibana dashboard. In this dashobard I've added 3 "saved search" created by me.  
Everything works fine. What I need to do now is to modify one of these "saved search" to be indipendet by the time range specified in the top-right corner. The output of the "saved search" should be the last N documents stored in the specified index (ignoring the time-range configured).

Is that possible?

Using the REST API I can write something like that:

```
GET /myindex-*/_search
{
   "size" : 3,
    "query": {
        "bool" : {
            "must" : {
                "match_all": {}
             },
              "filter": {
                  "range": {
                        "@timestamp": { "gt": "now-1y" }
                   }
              }
        }
    } 
}

```

I would like to create a search request to be added in my dashboard that reproduce the same query (better without specifying the range filter but to query the whole index to find the last 3 elements)

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [November 15, 2018, 2:33pm UTC](https://discuss.elastic.co/t/kibana-dashboard-get-the-last-10-elements-of-a-specific-index-ignoring-the-specified-time-range/156835/2 "2018-11-15T14:33:37Z")

</div>

Hi @faustf,

Hmm, I can think of only about dedicated index-pattern that doesn't use timestamp (same index, no space impact), see option 2 here for details [How to dissociate a visualization from timepicker](https://discuss.elastic.co/t/how-to-dissociate-a-visualization-from-timepicker/49659/2)

Best,  
Oleg

---

<div class="post-metadata">

### Author: ![faustf](https://avatars.discourse-cdn.com/v4/letter/f/ebca7d/32.png) [@faustf](https://discuss.elastic.co/u/faustf)
#### Post date: [November 15, 2018, 3:33pm UTC](https://discuss.elastic.co/t/kibana-dashboard-get-the-last-10-elements-of-a-specific-index-ignoring-the-specified-time-range/156835/3 "2018-11-15T15:33:03Z")

</div>

Thanks, I tried and it works but how can I show only the last N documents?

---

<div class="post-metadata">

### Author: ![azasypkin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azasypkin/32/42216_2.png) [@azasypkin](https://discuss.elastic.co/u/azasypkin)
#### Post date: [November 15, 2018, 4:34pm UTC](https://discuss.elastic.co/t/kibana-dashboard-get-the-last-10-elements-of-a-specific-index-ignoring-the-specified-time-range/156835/4 "2018-11-15T16:34:51Z")

</div>

Hmm, I was pretty sure that you could set the `size` property for saved search, but as per [https://github.com/elastic/kibana/issues/4060](https://github.com/elastic/kibana/issues/4060) it's not supported right now. Unfortunately I can't think of any good workaround for that.

---

<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: [December 13, 2018, 4:35pm UTC](https://discuss.elastic.co/t/kibana-dashboard-get-the-last-10-elements-of-a-specific-index-ignoring-the-specified-time-range/156835/5 "2018-12-13T16:35:13Z")

</div>

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