Fingerprint processor

Fingerprint processor

Computes a hash of the document’s content. You can use this hash for content fingerprinting).

Table 19. Fingerprint Options

NameRequiredDefaultDescription

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.

targetfield

no

fingerprint

Output field for the fingerprint.

salt

no

<none>

<a href=”https://en.wikipedia.org/wiki/Salt(cryptography)” class=”ulink” target=”_top”>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.

description

no

-

Description of the processor. Useful for describing the purpose of the processor or its configuration.

if

no

-

Conditionally execute the processor. See Conditionally run a processor.

ignore_failure

no

false

Ignore failures for the processor. See Handling pipeline failures.

on_failure

no

-

Handle failures for the processor. See Handling pipeline failures.

tag

no

-

Identifier for the processor. Useful for debugging and metrics.

Example

The following example illustrates the use of the fingerprint processor:

  1. resp = client.ingest.simulate(
  2. pipeline={
  3. "processors": [
  4. {
  5. "fingerprint": {
  6. "fields": [
  7. "user"
  8. ]
  9. }
  10. }
  11. ]
  12. },
  13. docs=[
  14. {
  15. "_source": {
  16. "user": {
  17. "last_name": "Smith",
  18. "first_name": "John",
  19. "date_of_birth": "1980-01-15",
  20. "is_active": True
  21. }
  22. }
  23. }
  24. ],
  25. )
  26. print(resp)
  1. response = client.ingest.simulate(
  2. body: {
  3. pipeline: {
  4. processors: [
  5. {
  6. fingerprint: {
  7. fields: [
  8. 'user'
  9. ]
  10. }
  11. }
  12. ]
  13. },
  14. docs: [
  15. {
  16. _source: {
  17. user: {
  18. last_name: 'Smith',
  19. first_name: 'John',
  20. date_of_birth: '1980-01-15',
  21. is_active: true
  22. }
  23. }
  24. }
  25. ]
  26. }
  27. )
  28. puts response
  1. const response = await client.ingest.simulate({
  2. pipeline: {
  3. processors: [
  4. {
  5. fingerprint: {
  6. fields: ["user"],
  7. },
  8. },
  9. ],
  10. },
  11. docs: [
  12. {
  13. _source: {
  14. user: {
  15. last_name: "Smith",
  16. first_name: "John",
  17. date_of_birth: "1980-01-15",
  18. is_active: true,
  19. },
  20. },
  21. },
  22. ],
  23. });
  24. console.log(response);
  1. POST _ingest/pipeline/_simulate
  2. {
  3. "pipeline": {
  4. "processors": [
  5. {
  6. "fingerprint": {
  7. "fields": ["user"]
  8. }
  9. }
  10. ]
  11. },
  12. "docs": [
  13. {
  14. "_source": {
  15. "user": {
  16. "last_name": "Smith",
  17. "first_name": "John",
  18. "date_of_birth": "1980-01-15",
  19. "is_active": true
  20. }
  21. }
  22. }
  23. ]
  24. }

Which produces the following result:

  1. {
  2. "docs": [
  3. {
  4. "doc": {
  5. ...
  6. "_source": {
  7. "fingerprint" : "WbSUPW4zY1PBPehh2AA/sSxiRjw=",
  8. "user" : {
  9. "last_name" : "Smith",
  10. "first_name" : "John",
  11. "date_of_birth" : "1980-01-15",
  12. "is_active" : true
  13. }
  14. }
  15. }
  16. }
  17. ]
  18. }