# Creating snapshot for a particular period. ( ex: 1-1-2017 to 31-12-2017)

**URL:** https://discuss.elastic.co/t/creating-snapshot-for-a-particular-period-ex-1-1-2017-to-31-12-2017/116837
**Category:** Elasticsearch
**Created:** [January 24, 2018, 9:54am UTC](https://discuss.elastic.co/t/creating-snapshot-for-a-particular-period-ex-1-1-2017-to-31-12-2017/116837 "2018-01-24T09:54:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sanjayap\_sanju](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sanjayap\_sanju](https://discuss.elastic.co/u/sanjayap_sanju)
#### Post date: [January 24, 2018, 9:54am UTC](https://discuss.elastic.co/t/creating-snapshot-for-a-particular-period-ex-1-1-2017-to-31-12-2017/116837/1 "2018-01-24T09:54:19Z")

</div>

Hi i am new to elasticsearch, was working on snapshot and restore of index. I was able to successfully take a snapshot and restore the entire index using the below query

PUT \_snapshot/testindex\_backup/16jan18  
{  
"indicies" : "testindex",  
"ignore\_unavailable" : "true",  
"include\_global\_state" : "false"  
}

But how can we take a snapshot of index with specific date

Scenario ; A index has data of 3 Years( i.e., 1-1-2015 to 31-12-2017 ), I want to take a snapshot of 1 year ( i.e., 1-1-2017 to 31-12-2017)

Could you help me with a query for a snapshot.

Thanks in advance

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 24, 2018, 10:09am UTC](https://discuss.elastic.co/t/creating-snapshot-for-a-particular-period-ex-1-1-2017-to-31-12-2017/116837/2 "2018-01-24T10:09:14Z")

</div>

You can't do that. Snapshot and Restore is about a whole index whatever the data you have inside.  
But you can use the reindex API to index in another index, like `index-2017` and then snapshot this index.

---

<div class="post-metadata">

### Author: ![sanjayap\_sanju](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sanjayap\_sanju](https://discuss.elastic.co/u/sanjayap_sanju)
#### Post date: [January 25, 2018, 7:36am UTC](https://discuss.elastic.co/t/creating-snapshot-for-a-particular-period-ex-1-1-2017-to-31-12-2017/116837/3 "2018-01-25T07:36:33Z")

</div>

Thanks for your response. In this case will reindex API give the exact 1 year data (i.e., 2017) out of 3 years of snapshot data(i.e., 2015 - 2017). Below the query we have used for reindexing the data from snapshot data(ticketanalysis) and reindexed to (new\_ticketanalysis).

```
POST _reindex
{
  "source": {
    "index": "ticketanalysis",
    "type": "fs",
    "query": {
        "range" : {
            "@timestamp" : {
                "gte": "01/01/2017",
                "lte": "01/31/2017",
                "format": "MM/dd/yyyy||yyyy"
            }
        }
    }
  },
  "dest": {
    "index": "new_ticketanalysis"
  }
}

```

This is the output we got

```
{
  "took": 2,
  "timed_out": false,
  "total": 0,
  "updated": 0,
  "created": 0,
  "deleted": 0,
  "batches": 0,
  "version_conflicts": 0,
  "noops": 0,
  "retries": {
    "bulk": 0,
    "search": 0
  },
  "throttled_millis": 0,
  "requests_per_second": -1,
  "throttled_until_millis": 0,
  "failures": []
}

```

Please suggest if any query modification is required.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [January 25, 2018, 9:08am UTC](https://discuss.elastic.co/t/creating-snapshot-for-a-particular-period-ex-1-1-2017-to-31-12-2017/116837/4 "2018-01-25T09:08:23Z")

</div>

What is the output of:

```auto
GET ticketanalysis/fs/_search
{
    "size": 0,
    "query": {
        "range" : {
            "@timestamp" : {
                "gte": "01/01/2017",
                "lte": "01/31/2017",
                "format": "MM/dd/yyyy||yyyy"
            }
        }
    }
}

```

If you are getting back no data, then you need to fix your query.  
Have a look at the mapping, try to reproduce with an example...

---

<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: [February 22, 2018, 9:08am UTC](https://discuss.elastic.co/t/creating-snapshot-for-a-particular-period-ex-1-1-2017-to-31-12-2017/116837/5 "2018-02-22T09:08:33Z")

</div>

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