create-connector-api.asciidoc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. [[create-connector-api]]
  2. === Create connector API
  3. ++++
  4. <titleabbrev>Create connector</titleabbrev>
  5. ++++
  6. beta::[]
  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. To get started with Connector APIs, check out the {enterprise-search-ref}/connectors-tutorial-api.html[tutorial^].
  13. [source,console]
  14. --------------------------------------------------
  15. PUT _connector/my-connector
  16. {
  17. "index_name": "search-google-drive",
  18. "name": "My Connector",
  19. "service_type": "google_drive"
  20. }
  21. --------------------------------------------------
  22. ////
  23. [source,console]
  24. ----
  25. DELETE _connector/my-connector
  26. ----
  27. // TEST[continued]
  28. ////
  29. [[create-connector-api-request]]
  30. ==== {api-request-title}
  31. * `POST _connector`
  32. * `PUT _connector/<connector_id>`
  33. [[create-connector-api-prereqs]]
  34. ==== {api-prereq-title}
  35. * 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.
  36. * 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.
  37. [[create-connector-api-desc]]
  38. ==== {api-description-title}
  39. 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.
  40. [[create-connector-api-path-params]]
  41. ==== {api-path-parms-title}
  42. `<connector_id>`::
  43. (Optional, string) Unique identifier of a connector.
  44. [role="child_attributes"]
  45. [[create-connector-api-request-body]]
  46. ==== {api-request-body-title}
  47. `description`::
  48. (Optional, string) The description of the connector.
  49. `index_name`::
  50. (Optional, string) The target index to sync data. If the index doesn't exist, it will be created upon the first sync.
  51. `name`::
  52. (Optional, string) The name of the connector. Setting the connector name is recommended when managing connectors in {kib}.
  53. `is_native`::
  54. (Optional, boolean) Indicates if it's a native connector. Defaults to `false`.
  55. `language`::
  56. (Optional, string) Language analyzer for the data. Limited to supported languages.
  57. `service_type`::
  58. (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.
  59. [role="child_attributes"]
  60. [[create-connector-api-response-body]]
  61. ==== {api-response-body-title}
  62. `id`::
  63. (string) The ID associated with the connector document. Returned when using a POST request.
  64. `result`::
  65. (string) The result of the indexing operation, `created` or `updated`. Returned when using a PUT request.
  66. [[create-connector-api-response-codes]]
  67. ==== {api-response-codes-title}
  68. `200`::
  69. Indicates that an existing connector was updated successfully.
  70. `201`::
  71. Indicates that the connector was created successfully.
  72. `400`::
  73. Indicates that the request was malformed.
  74. [[create-connector-api-example]]
  75. ==== {api-examples-title}
  76. [source,console]
  77. ----
  78. PUT _connector/my-connector
  79. {
  80. "index_name": "search-google-drive",
  81. "name": "My Connector",
  82. "description": "My Connector to sync data to Elastic index from Google Drive",
  83. "service_type": "google_drive",
  84. "language": "english"
  85. }
  86. ----
  87. The API returns the following result:
  88. [source,console-result]
  89. ----
  90. {
  91. "result": "created",
  92. "id": "my-connector"
  93. }
  94. ----
  95. ////
  96. [source,console]
  97. ----
  98. DELETE _connector/my-connector
  99. ----
  100. // TEST[continued]
  101. ////