Skip to content

Commit

Permalink
disallow delete indices, compat with es tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz committed Feb 27, 2024
1 parent f07ec1a commit e8d0a2b
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 10 deletions.
9 changes: 8 additions & 1 deletion quickwit/quickwit-index-management/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl IndexService {
let list_indexes_metadatas_request = ListIndexesMetadataRequest {
index_id_patterns: index_id_patterns.to_owned(),
};
// disallow index_id patterns containing *
// disallow index_id patterns
for index_id_pattern in &index_id_patterns {
if index_id_pattern.contains('*') {
return Err(IndexServiceError::Metastore(
Expand All @@ -244,6 +244,13 @@ impl IndexService {
},
));
}
if index_id_pattern == "_all" {
return Err(IndexServiceError::Metastore(
MetastoreError::InvalidArgument {
message: format!("index_id pattern _all not supported"),
},
));
}
}

let mut metastore = self.metastore.clone();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
--- #Create indices quickwit
engines:
- quickwit
method: POST
api_root: http://localhost:7280/api/v1/
endpoint: indexes/
Expand All @@ -9,6 +11,8 @@ json:
mode: dynamic
sleep_after: 3
---
engines:
- quickwit
method: POST
api_root: http://localhost:7280/api/v1/
endpoint: indexes/
Expand All @@ -18,26 +22,64 @@ json:
doc_mapping:
mode: dynamic
sleep_after: 3
--- # create indices elasticsearch
engines:
- elasticsearch
method: PUT
endpoint: test_index1
json: {
"mappings": {
"properties": {
"created_at": {
"type": "date",
"store": true
}
}
}
}
--- # create indices elasticsearch
engines:
- elasticsearch
method: PUT
endpoint: test_index2
json: {
"mappings": {
"properties": {
"created_at": {
"type": "date",
"store": true
}
}
}
}
---
engines:
- quickwit
- elasticsearch
method: DELETE
api_root: http://localhost:7280/api/v1/
endpoint: _elastic/test_index1,does_not_exist
endpoint: test_index1,does_not_exist
status_code: 404
--- # delete partially matching with ignore_unavailable
engines:
- quickwit
- elasticsearch
method: DELETE
api_root: http://localhost:7280/api/v1/
endpoint: _elastic/test_index1,does_not_exist
endpoint: test_index1,does_not_exist
status_code: 200
params:
ignore_unavailable: "true"
--- # already deleted
engines:
- quickwit
- elasticsearch
method: DELETE
api_root: http://localhost:7280/api/v1/
endpoint: _elastic/test_index1
endpoint: test_index1
status_code: 404
---
engines:
- quickwit
- elasticsearch
method: DELETE
api_root: http://localhost:7280/api/v1/
endpoint: _elastic/test_index2
endpoint: test_index2
status_code: 200

Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,12 @@ endpoint: gharchive
---
method: DELETE
endpoint: empty_index
---
method: DELETE
endpoint: test_index1
status_code: null
---
method: DELETE
endpoint: test_index2
status_code: null

0 comments on commit e8d0a2b

Please sign in to comment.