-
Notifications
You must be signed in to change notification settings - Fork 664
[DOC] Add drop processor #5767
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
Merged
Merged
[DOC] Add drop processor #5767
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
20c5fc6
Add drop processor doc to address content gap
vagimeli cc54f0b
Merge branch 'main' into drop-processor
vagimeli 6d0febd
Address tech review feedback
vagimeli 35a2053
Address tech review changes
vagimeli 73296f5
Delete _ingest-pipelines/processors/date.md
vagimeli b572c4d
Revert "Delete _ingest-pipelines/processors/date.md"
vagimeli fb049e8
Merge branch 'main' into drop-processor
vagimeli a3650f6
Merge branch 'main' into drop-processor
vagimeli 0efa50e
Merge branch 'main' into drop-processor
vagimeli b6f7902
Update _ingest-pipelines/processors/drop.md
vagimeli 8ee3c95
Update _ingest-pipelines/processors/drop.md
vagimeli 0046644
Update _ingest-pipelines/processors/drop.md
vagimeli 0ac9c1d
Update _ingest-pipelines/processors/drop.md
vagimeli 8081f65
Update _ingest-pipelines/processors/drop.md
vagimeli 4477666
Update drop.md
vagimeli e996085
Merge branch 'main' into drop-processor
vagimeli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| --- | ||
| layout: default | ||
| title: Drop | ||
| parent: Ingest processors | ||
| nav_order: 70 | ||
| --- | ||
|
|
||
| # Drop processor | ||
|
|
||
| The `drop` processor is used to discard documents without indexing them. This can be useful for preventing documents from being indexed based on certain conditions. For example, you might use a `drop` processor to prevent documents that are missing important fields or contain sensitive information from being indexed. | ||
|
|
||
| The `drop` processor does not raise any errors when it discards documents, making it useful for preventing indexing problems without cluttering your OpenSearch logs with error messages. | ||
|
|
||
| ## Syntax example | ||
|
|
||
| The following is the syntax for the `drop` processor: | ||
|
|
||
| ```json | ||
| { | ||
| "drop": { | ||
| "if": "ctx.foo == 'bar'" | ||
| } | ||
| } | ||
| ``` | ||
| {% include copy-curl.html %} | ||
|
|
||
| ## Configuration parameters | ||
|
|
||
| The following table lists the required and optional parameters for the `drop` processor. | ||
|
|
||
| Parameter | Required | Description | | ||
| |-----------|-----------|-----------| | ||
| `description` | Optional | A brief description of the processor. | | ||
| `if` | Optional | A condition for running the processor. | | ||
| `ignore_failure` | Optional | If set to `true`, failures are ignored. Default is `false`. See [Handling pipeline failures]({{site.url}}{{site.baseurl}}/ingest-pipelines/pipeline-failures/) for more information. | | ||
| `on_failure` | Optional | A list of processors to run if the processor fails. See [Handling pipeline failures]({{site.url}}{{site.baseurl}}/ingest-pipelines/pipeline-failures/) for more information. | | ||
| `tag` | Optional | An identifier tag for the processor. Useful for distinguishing between processors of the same type when debugging. | | ||
|
|
||
| ## Using the processor | ||
|
|
||
| Follow these steps to use the processor in a pipeline. | ||
|
|
||
| **Step 1: Create a pipeline** | ||
|
|
||
| The following query creates a pipeline, named `drop-pii`, that uses the `drop` processor to prevent a document containing personally identifiable information (PII) from being indexed: | ||
|
|
||
| ```json | ||
| PUT /_ingest/pipeline/drop-pii | ||
| { | ||
| "description": "Pipeline that prevents PII from being indexed", | ||
| "processors": [ | ||
| { | ||
| "drop": { | ||
| "if" : "ctx.user_info.contains('password') || ctx.user_info.contains('credit card')" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
| {% include copy-curl.html %} | ||
|
|
||
| **Step 2 (Optional): Test the pipeline** | ||
|
|
||
| It is recommended that you test your pipeline before ingesting documents. | ||
| {: .tip} | ||
|
|
||
| To test the pipeline, run the following query: | ||
|
|
||
| ```json | ||
| POST _ingest/pipeline/drop-pii/_simulate | ||
| { | ||
| "docs": [ | ||
| { | ||
| "_index": "testindex1", | ||
| "_id": "1", | ||
| "_source": { | ||
| "user_info": "Sensitive information including credit card" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
| {% include copy-curl.html %} | ||
|
|
||
| #### Response | ||
|
|
||
| The following example response confirms that the pipeline is working as expected (the document has been dropped): | ||
|
|
||
| ```json | ||
| { | ||
| "docs": [ | ||
| null | ||
| ] | ||
| } | ||
| ``` | ||
| {% include copy-curl.html %} | ||
|
|
||
| **Step 3: Ingest a document** | ||
|
|
||
| The following query ingests a document into an index named `testindex1`: | ||
|
|
||
| ```json | ||
| PUT testindex1/_doc/1?pipeline=drop-pii | ||
| { | ||
| "user_info": "Sensitive information including credit card" | ||
| } | ||
| ``` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The following response shows that the no operation happened, the document with id {
"_index": "testindex1",
"_id": "1",
"_version": -3,
"result": "noop",
"_shards": {
"total": 0,
"successful": 0,
"failed": 0
}
} |
||
| {% include copy-curl.html %} | ||
|
|
||
| The following response confirms that the document with the ID of `1` was not indexed: | ||
|
|
||
| { | ||
| "_index": "testindex1", | ||
| "_id": "1", | ||
| "_version": -3, | ||
| "result": "noop", | ||
| "_shards": { | ||
| "total": 0, | ||
| "successful": 0, | ||
| "failed": 0 | ||
| } | ||
| } | ||
| {% include copy-curl.html %} | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{
"drop": {
"if": "ctx.foo == 'bar'"
}
}