create-connector-api.asciidoc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. [[create-connector-api]]
  2. === Create connector API
  3. ++++
  4. <titleabbrev>Create connector</titleabbrev>
  5. ++++
  6. preview::[]
  7. Creates a connector.
  8. [source,console]
  9. --------------------------------------------------
  10. PUT _connector/my-connector
  11. {
  12. "index_name": "search-google-drive",
  13. "name": "My Connector",
  14. "service_type": "google_drive"
  15. }
  16. --------------------------------------------------
  17. ////
  18. [source,console]
  19. ----
  20. DELETE _connector/my-connector
  21. ----
  22. // TEST[continued]
  23. ////
  24. [[create-connector-api-request]]
  25. ==== {api-request-title}
  26. `POST _connector`
  27. `PUT _connector/<connector_id>`
  28. [[create-connector-api-prereqs]]
  29. ==== {api-prereq-title}
  30. * To sync data using connectors, it's essential to have the Elastic connectors service running.
  31. * The `service_type` parameter should reference an existing connector service type.
  32. [[create-connector-api-desc]]
  33. ==== {api-description-title}
  34. Creates a connector document in the internal index and initializes its configuration, filtering, and scheduling with default values. These values can be updated later as needed.
  35. [[create-connector-api-path-params]]
  36. ==== {api-path-parms-title}
  37. `<connector_id>`::
  38. (Required, string) Unique identifier of a connector.
  39. [role="child_attributes"]
  40. [[create-connector-api-request-body]]
  41. ==== {api-request-body-title}
  42. `description`::
  43. (Optional, string) The description of the connector.
  44. `index_name`::
  45. (Required, string) The target index for syncing data by the connector.
  46. `name`::
  47. (Optional, string) The name of the connector.
  48. `is_native`::
  49. (Optional, boolean) Indicates if it's a native connector. Defaults to `false`.
  50. `language`::
  51. (Optional, string) Language analyzer for the data. Limited to supported languages.
  52. `service_type`::
  53. (Optional, string) Connector service type. Can reference Elastic-supported connector types or a custom connector type.
  54. [role="child_attributes"]
  55. [[create-connector-api-response-body]]
  56. ==== {api-response-body-title}
  57. `id`::
  58. (string) The ID associated with the connector document. Returned when using a POST request.
  59. `result`::
  60. (string) The result of the indexing operation, `created` or `updated`. Returned when using a PUT request.
  61. [[create-connector-api-response-codes]]
  62. ==== {api-response-codes-title}
  63. `200`::
  64. Indicates that an existing connector was updated successfully.
  65. `201`::
  66. Indicates that the connector was created successfully.
  67. `400`::
  68. Indicates that the request was malformed.
  69. [[create-connector-api-example]]
  70. ==== {api-examples-title}
  71. [source,console]
  72. ----
  73. PUT _connector/my-connector
  74. {
  75. "index_name": "search-google-drive",
  76. "name": "My Connector",
  77. "description": "My Connector to sync data to Elastic index from Google Drive",
  78. "service_type": "google_drive",
  79. "language": "english"
  80. }
  81. ----
  82. The API returns the following result:
  83. [source,console-result]
  84. ----
  85. {
  86. "result": "created"
  87. }
  88. ----
  89. ////
  90. [source,console]
  91. ----
  92. DELETE _connector/my-connector
  93. ----
  94. // TEST[continued]
  95. ////