2016-04-28 9 views

答えて

1

インデックス作成時に格納されたsettings.index.creation_date値を取得できます。

curl -XGET localhost:9200/your_index/_settings 

をあなたが取得する:あなたが使用して簡単にそれを得ることができ、カールして

冗談で

{ 
    "your_index" : { 
    "settings" : { 
     "index" : { 
     "creation_date" : "1460663685415", <--- this is what you're looking for 
     "number_of_shards" : "5", 
     "number_of_replicas" : "1", 
     "version" : { 
      "created" : "1040599" 
     }, 
     "uuid" : "dIG5GYsMTueOwONu4RGSQw" 
     } 
    } 
    } 
} 

を、あなたが使用して同じ値を得ることができます

import io.searchbox.indices.settings.GetSettings; 

    GetSettings getSettings = new GetSettings.Builder().build(); 
    JestResult result = client.execute(getSettings); 

することができますJestResultを使用して、creation_date

私は何かを提案するかもしれないが、curatorは、あなたが必要とするものを達成するためのより手軽なツールになります。

は単純に一日一回、これを実行します。

curator delete indices --older-than 1 --time-unit days 
+0

はあなたがクライアント上で手の込んだことができます()管理者を()、ご返信用JestClient.thanksて、それを得るためにはIAMはできません。 – sweety

+0

申し訳ありません、私の悪い、私は私の答えを更新しました – Val

+0

私は絶対にJestクライアントを使用する必要があります。 – sweety

関連する問題