esql-enrich-data.asciidoc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. [[esql-enrich-data]]
  2. === Enrich data
  3. ++++
  4. <titleabbrev>Enrich data</titleabbrev>
  5. ++++
  6. You can use {esql}'s <<esql-enrich>> processing command to enrich a table with
  7. data from indices in {es}.
  8. For example, you can use `ENRICH` to:
  9. * Identify web services or vendors based on known IP addresses
  10. * Add product information to retail orders based on product IDs
  11. * Supplement contact information based on an email address
  12. [[esql-how-enrich-works]]
  13. ==== How the `ENRICH` command works
  14. The `ENRICH` command adds new columns to a table, with data from {es} indices.
  15. It requires a few special components:
  16. image::images/esql/esql-enrich.png[align="center"]
  17. [[esql-enrich-policy]]
  18. Enrich policy::
  19. +
  20. --
  21. A set of configuration options used to add the right enrich data to the input
  22. table.
  23. An enrich policy contains:
  24. include::../ingest/enrich.asciidoc[tag=enrich-policy-fields]
  25. After <<esql-create-enrich-policy,creating a policy>>, it must be
  26. <<esql-execute-enrich-policy,executed>> before it can be used. Executing an
  27. enrich policy uses data from the policy's source indices to create a streamlined
  28. system index called the _enrich index_. The `ENRICH` command uses this index to
  29. match and enrich an input table.
  30. --
  31. [[esql-source-index]]
  32. Source index::
  33. An index which stores enrich data that the `ENRICH` command can add to input
  34. tables. You can create and manage these indices just like a regular {es} index.
  35. You can use multiple source indices in an enrich policy. You also can use the
  36. same source index in multiple enrich policies.
  37. [[esql-enrich-index]]
  38. Enrich index::
  39. +
  40. --
  41. A special system index tied to a specific enrich policy.
  42. Directly matching rows from input tables to documents in source indices could be
  43. slow and resource intensive. To speed things up, the `ENRICH` command uses an
  44. enrich index.
  45. include::../ingest/enrich.asciidoc[tag=enrich-index]
  46. --
  47. [[esql-set-up-enrich-policy]]
  48. ==== Set up an enrich policy
  49. To start using `ENRICH`, follow these steps:
  50. . Check the <<enrich-prereqs, prerequisites>>.
  51. . <<esql-create-enrich-source-index>>.
  52. . <<esql-create-enrich-policy>>.
  53. . <<esql-execute-enrich-policy>>.
  54. . <<esql-use-enrich>>
  55. Once you have enrich policies set up, you can <<esql-update-enrich-data,update
  56. your enrich data>> and <<esql-update-enrich-policies, update your enrich
  57. policies>>.
  58. [IMPORTANT]
  59. ====
  60. The `ENRICH` command performs several operations and may impact the speed of
  61. your query.
  62. ====
  63. [[esql-enrich-prereqs]]
  64. ==== Prerequisites
  65. include::{es-repo-dir}/ingest/apis/enrich/put-enrich-policy.asciidoc[tag=enrich-policy-api-prereqs]
  66. [[esql-create-enrich-source-index]]
  67. ==== Add enrich data
  68. include::../ingest/enrich.asciidoc[tag=create-enrich-source-index]
  69. [[esql-create-enrich-policy]]
  70. ==== Create an enrich policy
  71. include::../ingest/enrich.asciidoc[tag=create-enrich-policy]
  72. [[esql-execute-enrich-policy]]
  73. ==== Execute the enrich policy
  74. include::../ingest/enrich.asciidoc[tag=execute-enrich-policy1]
  75. image::images/esql/esql-enrich-policy.png[align="center"]
  76. include::../ingest/enrich.asciidoc[tag=execute-enrich-policy2]
  77. [[esql-use-enrich]]
  78. ==== Use the enrich policy
  79. After the policy has been executed, you can use the <<esql-enrich,`ENRICH`
  80. command>> to enrich your data.
  81. image::images/esql/esql-enrich-command.png[align="center",width=50%]
  82. include::processing-commands/enrich.asciidoc[tag=examples]
  83. [[esql-update-enrich-data]]
  84. ==== Update an enrich index
  85. include::{es-repo-dir}/ingest/apis/enrich/execute-enrich-policy.asciidoc[tag=update-enrich-index]
  86. [[esql-update-enrich-policies]]
  87. ==== Update an enrich policy
  88. include::../ingest/enrich.asciidoc[tag=update-enrich-policy]