ingest.asciidoc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. [[ingest]]
  2. = Ingest node
  3. [partintro]
  4. --
  5. Use an ingest node to pre-process documents before the actual document indexing happens.
  6. The ingest node intercepts bulk and index requests, it applies transformations, and it then
  7. passes the documents back to the index or bulk APIs.
  8. All nodes enable ingest by default, so any node can handle ingest tasks. To
  9. create a dedicated ingest node, configure the <<modules-node,`node.roles`>>
  10. setting in `elasticsearch.yml` as follows:
  11. [source,yaml]
  12. ----
  13. node.roles: [ ingest ]
  14. ----
  15. To disable ingest for a node, specify the `node.roles` setting and exclude
  16. `ingest` from the listed roles.
  17. To pre-process documents before indexing, <<pipeline,define a pipeline>> that specifies a series of
  18. <<ingest-processors,processors>>. Each processor transforms the document in some specific way. For example, a
  19. pipeline might have one processor that removes a field from the document, followed by
  20. another processor that renames a field. The <<cluster-state,cluster state>> then stores
  21. the configured pipelines.
  22. To use a pipeline, simply specify the `pipeline` parameter on an index or bulk request. This
  23. way, the ingest node knows which pipeline to use.
  24. For example:
  25. Create a pipeline
  26. [source,console]
  27. --------------------------------------------------
  28. PUT _ingest/pipeline/my_pipeline_id
  29. {
  30. "description" : "describe pipeline",
  31. "processors" : [
  32. {
  33. "set" : {
  34. "field": "foo",
  35. "value": "new"
  36. }
  37. }
  38. ]
  39. }
  40. --------------------------------------------------
  41. Index with defined pipeline
  42. [source,console]
  43. --------------------------------------------------
  44. PUT my-index-000001/_doc/my-id?pipeline=my_pipeline_id
  45. {
  46. "foo": "bar"
  47. }
  48. --------------------------------------------------
  49. // TEST[continued]
  50. Response:
  51. [source,console-result]
  52. --------------------------------------------------
  53. {
  54. "_index" : "my-index-000001",
  55. "_id" : "my-id",
  56. "_version" : 1,
  57. "result" : "created",
  58. "_shards" : {
  59. "total" : 2,
  60. "successful" : 2,
  61. "failed" : 0
  62. },
  63. "_seq_no" : 0,
  64. "_primary_term" : 1
  65. }
  66. --------------------------------------------------
  67. // TESTRESPONSE[s/"successful" : 2/"successful" : 1/]
  68. An index may also declare a <<dynamic-index-settings,default pipeline>> that will be used in the
  69. absence of the `pipeline` parameter.
  70. Finally, an index may also declare a <<dynamic-index-settings,final pipeline>>
  71. that will be executed after any request or default pipeline (if any).
  72. See <<ingest-apis,Ingest APIs>> for more information about creating, adding, and deleting pipelines.
  73. --
  74. include::ingest/ingest-node.asciidoc[]