fingerprint.asciidoc 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[fingerprint-processor]]
  4. === Fingerprint processor
  5. ++++
  6. <titleabbrev>Fingerprint</titleabbrev>
  7. ++++
  8. Computes a hash of the document's content. You can use this hash for
  9. {wikipedia}/Fingerprint_(computing)[content fingerprinting].
  10. [[fingerprint-options]]
  11. .Fingerprint Options
  12. [options="header"]
  13. |======
  14. | Name | Required | Default | Description
  15. | `fields` | yes | n/a | Array of fields to include in
  16. the fingerprint. For objects, the processor hashes both the field key and
  17. value. For other fields, the processor hashes only the field value.
  18. | `target_field` | no | `fingerprint` | Output field for the fingerprint.
  19. | `salt` | no | <none> |
  20. {wikipedia}/Salt_(cryptography)[Salt value] for the hash function.
  21. | `method` | no | `SHA-1` | The cryptographic hash function used to
  22. compute the fingerprint. Must be one of `MD5`, `SHA-1`, `SHA-256`, or `SHA-512`.
  23. | `ignore_missing` | no | `false` | If `true`, the processor
  24. ignores any missing `fields`. If all fields are missing, the processor silently
  25. exits without modifying the document.
  26. include::common-options.asciidoc[]
  27. |======
  28. [discrete]
  29. [[fingerprint-processor-ex]]
  30. ===== Example
  31. The following example illustrates the use of the fingerprint processor:
  32. [source,console]
  33. ----
  34. POST _ingest/pipeline/_simulate
  35. {
  36. "pipeline": {
  37. "processors": [
  38. {
  39. "fingerprint": {
  40. "fields": ["user"]
  41. }
  42. }
  43. ]
  44. },
  45. "docs": [
  46. {
  47. "_source": {
  48. "user": {
  49. "last_name": "Smith",
  50. "first_name": "John",
  51. "date_of_birth": "1980-01-15",
  52. "is_active": true
  53. }
  54. }
  55. }
  56. ]
  57. }
  58. ----
  59. Which produces the following result:
  60. [source,console-result]
  61. ----
  62. {
  63. "docs": [
  64. {
  65. "doc": {
  66. ...
  67. "_source": {
  68. "fingerprint" : "WbSUPW4zY1PBPehh2AA/sSxiRjw=",
  69. "user" : {
  70. "last_name" : "Smith",
  71. "first_name" : "John",
  72. "date_of_birth" : "1980-01-15",
  73. "is_active" : true
  74. }
  75. }
  76. }
  77. }
  78. ]
  79. }
  80. ----
  81. // TESTRESPONSE[s/\.\.\./"_index":"_index","_id":"_id","_ingest":{"timestamp":$body.docs.0.doc._ingest.timestamp},/]