create-connector-api.asciidoc 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. [[create-connector-api]]
  2. === Create connector API
  3. ++++
  4. <titleabbrev>Create connector</titleabbrev>
  5. ++++
  6. preview::[]
  7. Creates an Elastic connector.
  8. Connectors are {es} integrations that bring content from third-party data sources, which can be deployed on {ecloud} or hosted on your own infrastructure:
  9. * *Native connectors* are a managed service on {ecloud}
  10. * *Connector clients* are self-managed on your infrastructure
  11. Find a list of all supported service types in the {enterprise-search-ref}/connectors.html[connectors documentation^].
  12. [source,console]
  13. --------------------------------------------------
  14. PUT _connector/my-connector
  15. {
  16. "index_name": "search-google-drive",
  17. "name": "My Connector",
  18. "service_type": "google_drive"
  19. }
  20. --------------------------------------------------
  21. ////
  22. [source,console]
  23. ----
  24. DELETE _connector/my-connector
  25. ----
  26. // TEST[continued]
  27. ////
  28. [[create-connector-api-request]]
  29. ==== {api-request-title}
  30. `POST _connector`
  31. `PUT _connector/<connector_id>`
  32. [[create-connector-api-prereqs]]
  33. ==== {api-prereq-title}
  34. * To sync data using self-managed connectors, you need to deploy the {enterprise-search-ref}/build-connector.html[Elastic connector service] on your own infrastructure. This service runs automatically on Elastic Cloud for native connectors.
  35. * The `service_type` parameter should reference a supported third-party service. See the available service types for {enterprise-search-ref}/native-connectors.html[native] and {enterprise-search-ref}/build-connector.html[self-managed] connectors. This can also reference the service type of your custom connector.
  36. [[create-connector-api-desc]]
  37. ==== {api-description-title}
  38. 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.
  39. [[create-connector-api-path-params]]
  40. ==== {api-path-parms-title}
  41. `<connector_id>`::
  42. (Required, string) Unique identifier of a connector.
  43. [role="child_attributes"]
  44. [[create-connector-api-request-body]]
  45. ==== {api-request-body-title}
  46. `description`::
  47. (Optional, string) The description of the connector.
  48. `index_name`::
  49. (Optional, string) The target index to sync data. If the index doesn't exist, it will be created upon the first sync.
  50. `name`::
  51. (Optional, string) The name of the connector. Setting the connector name is recommended when managing connectors in {kib}.
  52. `is_native`::
  53. (Optional, boolean) Indicates if it's a native connector. Defaults to `false`.
  54. `language`::
  55. (Optional, string) Language analyzer for the data. Limited to supported languages.
  56. `service_type`::
  57. (Optional, string) Connector service type. Can reference Elastic-supported third-party services or a custom connector type. See the available service types for {enterprise-search-ref}/native-connectors.html[native] and {enterprise-search-ref}/build-connector.html[self-managed] connectors.
  58. [role="child_attributes"]
  59. [[create-connector-api-response-body]]
  60. ==== {api-response-body-title}
  61. `id`::
  62. (string) The ID associated with the connector document. Returned when using a POST request.
  63. `result`::
  64. (string) The result of the indexing operation, `created` or `updated`. Returned when using a PUT request.
  65. [[create-connector-api-response-codes]]
  66. ==== {api-response-codes-title}
  67. `200`::
  68. Indicates that an existing connector was updated successfully.
  69. `201`::
  70. Indicates that the connector was created successfully.
  71. `400`::
  72. Indicates that the request was malformed.
  73. [[create-connector-api-example]]
  74. ==== {api-examples-title}
  75. [source,console]
  76. ----
  77. PUT _connector/my-connector
  78. {
  79. "index_name": "search-google-drive",
  80. "name": "My Connector",
  81. "description": "My Connector to sync data to Elastic index from Google Drive",
  82. "service_type": "google_drive",
  83. "language": "english"
  84. }
  85. ----
  86. The API returns the following result:
  87. [source,console-result]
  88. ----
  89. {
  90. "result": "created"
  91. }
  92. ----
  93. ////
  94. [source,console]
  95. ----
  96. DELETE _connector/my-connector
  97. ----
  98. // TEST[continued]
  99. ////