fingerprint.asciidoc 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. [role="xpack"]
  2. [[fingerprint-processor]]
  3. === Fingerprint processor
  4. ++++
  5. <titleabbrev>Fingerprint</titleabbrev>
  6. ++++
  7. Computes a hash of the document's content. You can use this hash for
  8. {wikipedia}/Fingerprint_(computing)[content fingerprinting].
  9. [[fingerprint-options]]
  10. .Fingerprint Options
  11. [options="header"]
  12. |======
  13. | Name | Required | Default | Description
  14. | `fields` | yes | n/a | Array of fields to include in
  15. the fingerprint. For objects, the processor hashes both the field key and
  16. value. For other fields, the processor hashes only the field value.
  17. | `target_field` | no | `fingerprint` | Output field for the fingerprint.
  18. | `salt` | no | <none> |
  19. {wikipedia}/Salt_(cryptography)[Salt value] for the hash function.
  20. | `method` | no | `SHA-1` | The hash method used to
  21. compute the fingerprint. Must be one of `MD5`, `SHA-1`, `SHA-256`, `SHA-512`, or
  22. `MurmurHash3`.
  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","_version":"-3","_ingest":{"timestamp":$body.docs.0.doc._ingest.timestamp},/]