Skip to content

Commit

Permalink
support bulk ingest over PUT (#4997)
Browse files Browse the repository at this point in the history
* accept bulk request over PUT

* add test for bulk over put
  • Loading branch information
trinity-1686a committed May 20, 2024
1 parent 2da14a1 commit e38bd6f
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 4 deletions.
4 changes: 2 additions & 2 deletions quickwit/quickwit-serve/src/elasticsearch_api/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub(crate) fn elasticsearch_filter(
pub(crate) fn elastic_bulk_filter(
) -> impl Filter<Extract = (Body, ElasticBulkOptions), Error = Rejection> + Clone {
warp::path!("_elastic" / "_bulk")
.and(warp::post())
.and(warp::post().or(warp::put()).unify())
.and(warp::body::content_length_limit(
CONTENT_LENGTH_LIMIT.as_u64(),
))
Expand All @@ -97,7 +97,7 @@ pub(crate) fn elastic_bulk_filter(
pub(crate) fn elastic_index_bulk_filter(
) -> impl Filter<Extract = (String, Body, ElasticBulkOptions), Error = Rejection> + Clone {
warp::path!("_elastic" / String / "_bulk")
.and(warp::post())
.and(warp::post().or(warp::put()).unify())
.and(warp::body::content_length_limit(
CONTENT_LENGTH_LIMIT.as_u64(),
))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
method: PUT
ndjson:
- index: { "_index": "test-index", "_id": "1" }
- message: Hello, World!
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Delete possibly remaining index
method: DELETE
endpoint: test-index
status_code: null
---
method: PUT
endpoint: test-index
json: {
"mappings": {
"properties": {
"message": {
"type": "text",
"store": true
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Delete possibly remaining index
method: DELETE
api_root: http://localhost:7280/api/v1/
endpoint: indexes/test-index
status_code: null
---
method: POST
api_root: http://localhost:7280/api/v1/
endpoint: indexes/
json:
version: "0.7"
index_id: test-index
doc_mapping:
field_mappings:
- name: message
type: text
sleep_after: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
method: DELETE
endpoint: test-index
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
method: DELETE
api_root: http://localhost:7280/api/v1/
endpoint: indexes/test-index
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# # Delete index
# method: DELETE
# endpoint: indexes/simple
method: DELETE
endpoint: indexes/sortorder

0 comments on commit e38bd6f

Please sign in to comment.