Skip to content

feat(specs): add global push endpoint #4855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions specs/ingestion/common/parameters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,11 @@ orderKeys:
description: Ascending or descending sort order.
default: desc
enum: [asc, desc]

watch:
name: watch
in: query
description: When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
required: false
schema:
type: boolean
21 changes: 21 additions & 0 deletions specs/ingestion/common/schemas/task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -606,3 +606,24 @@ Policies:
type: integer
minimum: 1
maximum: 10

PushTaskPayload:
title: pushTaskPayload
type: object
properties:
action:
$ref: '../../../common/schemas/Batch.yml#/action'
records:
type: array
items:
title: pushTaskRecords
type: object
additionalProperties: true
required:
- objectID
properties:
objectID:
$ref: '../../../common/parameters.yml#/objectID'
required:
- action
- records
31 changes: 31 additions & 0 deletions specs/ingestion/paths/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
post:
summary: Push a `batch` request payload through the Pipeline
description: Push a `batch` request payload through the Pipeline. You can check the status of your request with the observability endpoints.
operationId: push
x-acl:
- addObject
- deleteIndex
- editSettings
x-timeouts:
connect: 180000
read: 180000
write: 180000
parameters:
- $ref: '../../common/parameters.yml#/IndexName'
- $ref: '../common/parameters.yml#/watch'
requestBody:
description: Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
content:
application/json:
schema:
$ref: '../common/schemas/task.yml#/PushTaskPayload'
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '../common/schemas/common.yml#/WatchResponse'
'400':
$ref: '../../common/responses/BadRequest.yml'
27 changes: 2 additions & 25 deletions specs/ingestion/paths/tasks/v2/pushTask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,13 @@ post:
write: 180000
parameters:
- $ref: '../../../common/parameters.yml#/pathTaskID'
- name: watch
in: query
description: When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
required: false
schema:
type: boolean
- $ref: '../../../common/parameters.yml#/watch'
requestBody:
description: Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
content:
application/json:
schema:
title: pushTaskPayload
type: object
properties:
action:
$ref: '../../../../common/schemas/Batch.yml#/action'
records:
type: array
items:
title: pushTaskRecords
type: object
additionalProperties: true
required:
- objectID
properties:
objectID:
$ref: '../../../../common/parameters.yml#/objectID'
required:
- action
- records
$ref: '../../../common/schemas/task.yml#/PushTaskPayload'
required: true
responses:
'200':
Expand Down
3 changes: 3 additions & 0 deletions specs/ingestion/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ paths:
/{path}:
$ref: '../common/paths/customRequest.yml'

/1/push/{indexName}:
$ref: 'paths/push.yml'

# authentications API.
/1/authentications:
$ref: 'paths/authentications/authentications.yml'
Expand Down
86 changes: 86 additions & 0 deletions tests/CTS/requests/ingestion/push.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[
{
"testName": "global push",
"parameters": {
"indexName": "foo",
"pushTaskPayload": {
"action": "addObject",
"records": [
{
"key": "bar",
"foo": "1",
"objectID": "o"
},
{
"key": "baz",
"foo": "2",
"objectID": "k"
}
]
}
},
"request": {
"path": "/1/push/foo",
"method": "POST",
"body": {
"action": "addObject",
"records": [
{
"key": "bar",
"foo": "1",
"objectID": "o"
},
{
"key": "baz",
"foo": "2",
"objectID": "k"
}
]
}
}
},
{
"testName": "global push with watch mode",
"parameters": {
"indexName": "bar",
"pushTaskPayload": {
"action": "addObject",
"records": [
{
"key": "bar",
"foo": "1",
"objectID": "o"
},
{
"key": "baz",
"foo": "2",
"objectID": "k"
}
]
},
"watch": true
},
"request": {
"path": "/1/push/bar",
"method": "POST",
"queryParameters": {
"watch": "true"
},
"body": {
"action": "addObject",
"records": [
{
"key": "bar",
"foo": "1",
"objectID": "o"
},
{
"key": "baz",
"foo": "2",
"objectID": "k"
}
]
}
}
}
]