私は、Javaでプロジェクトを作成しています。ここで私はelastic search 2.3.3を使用してデータをインデックスします。索引には2つのタイプがあります。私は特定の名前のインデックスを削除してのみ入力する必要がインデックスを削除するインデックス名とタイプでインデックスを取得するelasticSearch 2.3.3 in java
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 1,
"hits": [
{
"_index": "test_index",
"_type": "movies",
"_id": "uReb0g9KSLKS18sTATdr3A",
"_score": 1,
"_source": {
"genre": "Thriller"
}
},
{
"_index": "test_index",
"_type": "drama",
"_id": "cReb0g9KSKLS18sTATdr3B",
"_score": 1,
"_source": {
"genre": "SuperNatural"
}
},
{
"_index": "index1",
"_type": "drama",
"_id": "cReb0g9KSKLS18sT76ng3B",
"_score": 1,
"_source": {
"genre": "Romance"
}
}
]
}
}
:よう
マイインデックスドキュメントが見えます。例えばのために
: -上記のドキュメントから、私は名前「test_index」とインデックスを削除し、「ドラマ」を入力します。
だから、結果は次のようになります。
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 1,
"hits": [
{
"_index": "test_index",
"_type": "movies",
"_id": "uReb0g9KSLKS18sTATdr3A",
"_score": 1,
"_source": {
"genre": "Thriller"
}
},
{
"_index": "index1",
"_type": "drama",
"_id": "cReb0g9KSKLS18sT76ng3B",
"_score": 1,
"_source": {
"genre": "Romance"
}
}
]
}
}
ソリューションは試してみました:。
client.adminを()インデックス()(新DeleteIndexRequest( "test_index")を削除しactionGet(。。 );
しかし、それは
名 "test_index" との両方のインデックスを削除します10私も同じよう センスベータプラグインで様々なクエリを試してみました:それはエラーになりますDELETE/test_index /ドラマ
:ませハンドラは[URI [/ test_index /ドラマ]及び方法が見つかりませんDELETE]
DELETE/test_index /ドラマ/ _query Q = _id:?* & analyze_wildcard =真
それをまた動作しません。
私はインデックスのIDを私たちに知られていないその時点でインデックスを削除すると私は名前とタイプだけでインデックスを削除する必要があります。
java apiを使用して必要なインデックスを削除するにはどうすればよいですか?
のお手伝いをすることができるかもしれません。co/guide/en/elasticsearch/plugins/2.3/plugins-delete-by-query.html)?最新のクエリは私のために働き、 'test_index/drama'からドキュメントだけを削除します – Val