ingest.asciidoc 2.5 KB

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