elasticsearch/docs/reference/ingest/processors/fingerprint.asciidoc
Stuart Tettemer d42211c431
Ingest: IngestDocument requires non-null version (#87665)
Changes the type of the version parameter in `IngestDocument` from
`Long` to `long` and moves it to the third argument, so all required
values occur before nullable arguments.

The `IngestService` expects a non-null version for a document and will
throw an `NullPointerException` if one is not provided.

Related: #87309
2022-06-15 07:50:45 -05:00

89 lines
2.2 KiB
Text

[role="xpack"]
[[fingerprint-processor]]
=== Fingerprint processor
++++
<titleabbrev>Fingerprint</titleabbrev>
++++
Computes a hash of the document's content. You can use this hash for
{wikipedia}/Fingerprint_(computing)[content fingerprinting].
[[fingerprint-options]]
.Fingerprint Options
[options="header"]
|======
| Name | Required | Default | Description
| `fields` | yes | n/a | Array of fields to include in
the fingerprint. For objects, the processor hashes both the field key and
value. For other fields, the processor hashes only the field value.
| `target_field` | no | `fingerprint` | Output field for the fingerprint.
| `salt` | no | <none> |
{wikipedia}/Salt_(cryptography)[Salt value] for the hash function.
| `method` | no | `SHA-1` | The hash method used to
compute the fingerprint. Must be one of `MD5`, `SHA-1`, `SHA-256`, `SHA-512`, or
`MurmurHash3`.
| `ignore_missing` | no | `false` | If `true`, the processor
ignores any missing `fields`. If all fields are missing, the processor silently
exits without modifying the document.
include::common-options.asciidoc[]
|======
[discrete]
[[fingerprint-processor-ex]]
===== Example
The following example illustrates the use of the fingerprint processor:
[source,console]
----
POST _ingest/pipeline/_simulate
{
"pipeline": {
"processors": [
{
"fingerprint": {
"fields": ["user"]
}
}
]
},
"docs": [
{
"_source": {
"user": {
"last_name": "Smith",
"first_name": "John",
"date_of_birth": "1980-01-15",
"is_active": true
}
}
}
]
}
----
Which produces the following result:
[source,console-result]
----
{
"docs": [
{
"doc": {
...
"_source": {
"fingerprint" : "WbSUPW4zY1PBPehh2AA/sSxiRjw=",
"user" : {
"last_name" : "Smith",
"first_name" : "John",
"date_of_birth" : "1980-01-15",
"is_active" : true
}
}
}
}
]
}
----
// TESTRESPONSE[s/\.\.\./"_index":"_index","_id":"_id","_version":"-3","_ingest":{"timestamp":$body.docs.0.doc._ingest.timestamp},/]