Fingerprint processor
Fingerprint processor
Computes a hash of the document’s content. You can use this hash for content fingerprinting).
Table 19. Fingerprint Options
Name | Required | Default | Description |
---|---|---|---|
| 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. |
| no |
| Output field for the fingerprint. |
| no | <none> | <a href=”https://en.wikipedia.org/wiki/Salt(cryptography)” class=”ulink” target=”_top”>Salt value for the hash function. |
| no |
| The hash method used to compute the fingerprint. Must be one of |
| no |
| If |
| no | - | Description of the processor. Useful for describing the purpose of the processor or its configuration. |
| no | - | Conditionally execute the processor. See Conditionally run a processor. |
| no |
| Ignore failures for the processor. See Handling pipeline failures. |
| no | - | Handle failures for the processor. See Handling pipeline failures. |
| no | - | Identifier for the processor. Useful for debugging and metrics. |
Example
The following example illustrates the use of the fingerprint processor:
resp = client.ingest.simulate(
pipeline={
"processors": [
{
"fingerprint": {
"fields": [
"user"
]
}
}
]
},
docs=[
{
"_source": {
"user": {
"last_name": "Smith",
"first_name": "John",
"date_of_birth": "1980-01-15",
"is_active": True
}
}
}
],
)
print(resp)
response = client.ingest.simulate(
body: {
pipeline: {
processors: [
{
fingerprint: {
fields: [
'user'
]
}
}
]
},
docs: [
{
_source: {
user: {
last_name: 'Smith',
first_name: 'John',
date_of_birth: '1980-01-15',
is_active: true
}
}
}
]
}
)
puts response
const response = await client.ingest.simulate({
pipeline: {
processors: [
{
fingerprint: {
fields: ["user"],
},
},
],
},
docs: [
{
_source: {
user: {
last_name: "Smith",
first_name: "John",
date_of_birth: "1980-01-15",
is_active: true,
},
},
},
],
});
console.log(response);
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:
{
"docs": [
{
"doc": {
...
"_source": {
"fingerprint" : "WbSUPW4zY1PBPehh2AA/sSxiRjw=",
"user" : {
"last_name" : "Smith",
"first_name" : "John",
"date_of_birth" : "1980-01-15",
"is_active" : true
}
}
}
}
]
}