When I try to list a specific index to take a snapshot of, the library 
seems to ignore it, and instead takes a snapshot of my entire cluster. It's 
the end of the day, and I'm likely missing something obvious, so any help 
would be appreciated.

Ultimately, I'm trying to do the equivalent of:

curl -XPUT "localhost:9200/_snapshot/my_backup/snapshot_1" -d '{
>     "indices": "logstash-2014.09.25",
>     "ignore_unavailable": "true",
>     "include_global_state": false
> }'
>


Here is my function:

function take(
>         $name,
>         $indices = array(),
>         $settings = array(
>             'wait_for_completion' => true,
>             'ignore_unavailable' => "true",
>             'include_global_state' => false
>         )
>     ) {
>         $params['repository'] = $this->clusterConfig['repository'];
>         $params['snapshot'] = $name;
>         $params['custom'] = array(
>             'ignore_unavailable' => $settings['ignore_unavailable'],
>             'include_global_state' => $settings['include_global_state']
>         );
>         $indicesString = "";
>         if (!empty($indices)) {
>             foreach ($indices as $value) {
>                 $indicesString .= $value . ",";
>             }
>             //remove ending comma
>             $indicesString = rtrim($indicesString, ",");
>             $params['custom']['indices'] = $indicesString;
>         }
>         $result = $this->es->snapshot()->create($params);
>         if (!$result['acknowledged']) {
>             $this->logger->addError("Failed to take snapshot $name in 
> cluster $this->clusterName.");
>         }
>     }
>

Called like:

take("testingstuff-logstash-2014.09.25",array("logstash-2014.09.25"));
>

$this->es is an instance of Elasticsearch\Client. 

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/6418b7e0-fa47-4446-8292-859017976658%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to