-
Notifications
You must be signed in to change notification settings - Fork 503
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
[DOC] Add drop processor #5767
[DOC] Add drop processor #5767
Changes from 2 commits
20c5fc6
cc54f0b
6d0febd
35a2053
73296f5
b572c4d
fb049e8
a3650f6
0efa50e
b6f7902
8ee3c95
0046644
0ac9c1d
8081f65
4477666
e996085
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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. Oh my mad, this file shouldn't be removed, I just saw this change was not related to the drop processor so I thought it shouldn't be in this PR, actually it was a small change for the date processor, so please add this file back, thanks! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
--- | ||
layout: default | ||
title: Drop | ||
parent: Ingest processors | ||
nav_order: 70 | ||
--- | ||
|
||
# Drop processor | ||
|
||
The `drop` processor is used to discard documents without indexing them. This is 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. | ||
vagimeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 | ||
{ | ||
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. { |
||
"drop": { | ||
"if": "date_field", | ||
"field": "field-to-be-dropped"]" | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Configuration parameters | ||
Check failure on line 28 in _ingest-pipelines/processors/drop.md GitHub Actions / vale[vale] _ingest-pipelines/processors/drop.md#L28
Raw output
|
||
|
||
The following table lists the required and optional parameters for the `date` processor. | ||
|
||
Parameter | Required | Description | | ||
|-----------|-----------|-----------| | ||
`description` | Optional | A brief description of the processor. | | ||
`if` | Optional | A condition for running this processor. | | ||
vagimeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`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 debugging to distinguish between processors of the same type. | | ||
vagimeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Using the processor | ||
|
||
Follow these steps to use the processor in a pipeline. | ||
|
||
**Step 1: Create a pipeline.** | ||
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. Global: I believe that these do not take periods. |
||
|
||
The following query creates a pipeline, named `drop-user`, 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 you ingest documents. | ||
vagimeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{: .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: | ||
|
||
```json | ||
{ | ||
"docs": [ | ||
vagimeli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
"doc": { | ||
"_index": "testindex1", | ||
"_id": "1", | ||
"_source": { | ||
"user_info": "Sensitive information including credit card" | ||
}, | ||
"_ingest": { | ||
"timestamp": "2023-12-01T20:49:52.476308925Z" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
**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" | ||
} | ||
``` | ||
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 %} | ||
|
||
**Step 4 (Optional): Retrieve the document.** | ||
|
||
To retrieve the document, run the following query: | ||
|
||
```json | ||
GET testindex1/_doc/1 | ||
``` | ||
{% include copy-curl.html %} |
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.
Should this file be removed?