1
0

create-connector-api.asciidoc 2.9 KB

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