Ana içeriğe geç

Elasticsearch Connection

General Information​

Connection Type​

elasticsearch

UI Documentation​

Endpoints​

List Connections​

GET /apiops/projects/{projectName}/connections/?type=elasticsearch

Get Connection​

GET /apiops/projects/{projectName}/connections/{connectionName}/

Create Connection​

POST /apiops/projects/{projectName}/connections/{connectionName}/

Update Connection​

PUT /apiops/projects/{projectName}/connections/{connectionName}/

Delete Connection​

DELETE /apiops/projects/{projectName}/connections/{connectionName}/

List Connections​

Endpoint​

GET /apiops/projects/{projectName}/connections/?type=elasticsearch

Request​

Headers​

HeaderValue
AuthorizationBearer {token}

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name

Note: The type query parameter is required to filter connections by type.

cURL Example​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/connections/?type=elasticsearch" \
-H "Authorization: Bearer YOUR_TOKEN"

Get Connection​

Endpoint​

GET /apiops/projects/{projectName}/connections/{connectionName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name

Response​

Success Response (200 OK)​

{
"success": true,
"resultList": [
{
"type": "elasticsearch",
"name": "my-elasticsearch-connection",
"description": "Elasticsearch connection for logging",
"enabled": true,
"administrate": true,
"elasticHostList": [
{
"scheme": "http",
"host": "localhost",
"port": 9200
},
{
"scheme": "https",
"host": "elasticsearch.example.com",
"port": 9200
}
],
"authenticate": true,
"elasticUsername": "elastic",
"elasticPassword": null,
"encryptCommunication": true,
"encryptCommunicationType": "CA_CERTIFICATE_IN_PKCS_12",
"caCertInPkcs12File": null,
"caCertInPkcs12FileContentType": "application/x-pkcs12",
"caInPemFile": null,
"caInPemFileContentType": null,
"caTruststoreFile": null,
"caTruststoreFileContentType": null,
"caTruststoreFilePass": null,
"caKeystoreFile": null,
"caKeystoreFileContentType": null,
"caKeystoreFilePass": null,
"disableHostnameVerification": false,
"indexLifecyclePolicyCreated": true,
"indexLifecyclePolicy": {
"policyName": "apinizer-log-ilm-policy-default",
"enableHotPhase": true,
"maxAgeOfRollover": 30,
"maxIndexSizeOfRollover": 30,
"maxDocCountOfRollover": 15000000,
"enableWarmPhase": true,
"numberOfReplicasForWarm": 0,
"maxNumShardsForShrink": 1,
"maxNumSegmentsForForceMerge": 1,
"enableColdPhase": true,
"minAgeOfCold": 90,
"numberOfReplicasForCold": 0,
"enableDeletePhase": true,
"minAgeOfDelete": 365
},
"indexTemplateCreated": true,
"lastStatusCheckFailed": false,
"indexTemplateName": "apinizer-log-template",
"indexName": "apinizer-logs",
"indexTemplateNumberOfShards": 1,
"indexTemplateNumberOfReplicas": 1,
"indexTemplateRefreshInterval": "1s",
"connectionTimeoutInMs": 5000,
"bulkBufferCapacity": 50000,
"bulkFlushIntervalMs": 100,
"bulkMaxBatchSize": 2500,
"elasticsearchType": "READ_WRITE",
"elasticsearchMajorVersion": "AUTO_DETECT"
}
],
"resultCount": 1
}

Note: Secret fields are masked in get operations.

cURL Example​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/connections/my-elasticsearch-connection/" \
-H "Authorization: Bearer YOUR_TOKEN"

Create Connection​

Endpoint​

POST /apiops/projects/{projectName}/connections/{connectionName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}
Content-Typeapplication/json

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name

Request Body​

Full JSON Body Example - Basic Configuration​
{
"type": "elasticsearch",
"name": "my-elasticsearch-connection",
"description": "Elasticsearch connection for logging",
"enabled": true,
"administrate": true,
"elasticHostList": [
{
"scheme": "http",
"host": "localhost",
"port": 9200
}
],
"authenticate": false,
"elasticUsername": null,
"elasticPassword": null,
"encryptCommunication": false,
"encryptCommunicationType": null,
"caCertInPkcs12File": null,
"caCertInPkcs12FileContentType": null,
"caInPemFile": null,
"caInPemFileContentType": null,
"caTruststoreFile": null,
"caTruststoreFileContentType": null,
"caTruststoreFilePass": null,
"caKeystoreFile": null,
"caKeystoreFileContentType": null,
"caKeystoreFilePass": null,
"disableHostnameVerification": false,
"indexLifecyclePolicyCreated": false,
"indexLifecyclePolicy": null,
"indexTemplateCreated": false,
"indexTemplateName": null,
"indexName": null,
"indexTemplateNumberOfShards": null,
"indexTemplateNumberOfReplicas": null,
"indexTemplateRefreshInterval": null,
"connectionTimeoutInMs": null,
"bulkBufferCapacity": null,
"bulkFlushIntervalMs": null,
"bulkMaxBatchSize": null,
"elasticsearchType": "READ_WRITE",
"elasticsearchMajorVersion": "AUTO_DETECT"
}
Full JSON Body Example - With Authentication​
{
"type": "elasticsearch",
"name": "my-elasticsearch-connection",
"description": "Elasticsearch connection with authentication",
"enabled": true,
"administrate": true,
"elasticHostList": [
{
"scheme": "https",
"host": "elasticsearch.example.com",
"port": 9200
}
],
"authenticate": true,
"elasticUsername": "elastic",
"elasticPassword": "changeme",
"encryptCommunication": false,
"encryptCommunicationType": null,
"disableHostnameVerification": false,
"elasticsearchType": "READ_WRITE"
}
Full JSON Body Example - With Encryption (PKCS12)​
{
"type": "elasticsearch",
"name": "my-elasticsearch-connection",
"description": "Elasticsearch connection with PKCS12 encryption",
"enabled": true,
"administrate": true,
"elasticHostList": [
{
"scheme": "https",
"host": "elasticsearch.example.com",
"port": 9200
}
],
"authenticate": true,
"elasticUsername": "elastic",
"elasticPassword": "changeme",
"encryptCommunication": true,
"encryptCommunicationType": "CA_CERTIFICATE_IN_PKCS_12",
"caCertInPkcs12File": "<base64-encoded-pkcs12-file>",
"caCertInPkcs12FileContentType": "application/x-pkcs12",
"caInPemFile": null,
"caInPemFileContentType": null,
"caTruststoreFile": null,
"caTruststoreFileContentType": null,
"caTruststoreFilePass": "keystore-password",
"caKeystoreFile": null,
"caKeystoreFileContentType": null,
"caKeystoreFilePass": null,
"disableHostnameVerification": false,
"elasticsearchType": "READ_WRITE"
}
Full JSON Body Example - With Encryption (PEM)​
{
"type": "elasticsearch",
"name": "my-elasticsearch-connection",
"description": "Elasticsearch connection with PEM encryption",
"enabled": true,
"administrate": true,
"elasticHostList": [
{
"scheme": "https",
"host": "elasticsearch.example.com",
"port": 9200
}
],
"authenticate": true,
"elasticUsername": "elastic",
"elasticPassword": "changeme",
"encryptCommunication": true,
"encryptCommunicationType": "CA_IN_PEM_FILE",
"caCertInPkcs12File": null,
"caCertInPkcs12FileContentType": null,
"caInPemFile": "<base64-encoded-pem-file>",
"caInPemFileContentType": "application/x-pem-file",
"caTruststoreFile": null,
"caTruststoreFileContentType": null,
"caTruststoreFilePass": null,
"caKeystoreFile": null,
"caKeystoreFileContentType": null,
"caKeystoreFilePass": null,
"disableHostnameVerification": false,
"elasticsearchType": "READ_WRITE"
}
Full JSON Body Example - With Index Lifecycle Policy and Template​
{
"type": "elasticsearch",
"name": "my-elasticsearch-connection",
"description": "Elasticsearch connection with ILM and template",
"enabled": true,
"administrate": true,
"elasticHostList": [
{
"scheme": "http",
"host": "localhost",
"port": 9200
}
],
"authenticate": false,
"encryptCommunication": false,
"indexLifecyclePolicyCreated": true,
"indexLifecyclePolicy": {
"policyName": "apinizer-log-ilm-policy",
"enableHotPhase": true,
"maxAgeOfRollover": 30,
"maxIndexSizeOfRollover": 30,
"maxDocCountOfRollover": 15000000,
"enableWarmPhase": true,
"numberOfReplicasForWarm": 0,
"maxNumShardsForShrink": 1,
"maxNumSegmentsForForceMerge": 1,
"enableColdPhase": true,
"minAgeOfCold": 90,
"numberOfReplicasForCold": 0,
"enableDeletePhase": true,
"minAgeOfDelete": 365
},
"indexTemplateCreated": true,
"indexTemplateName": "apinizer-log-template",
"indexName": "apinizer-logs",
"indexTemplateNumberOfShards": 1,
"indexTemplateNumberOfReplicas": 1,
"indexTemplateRefreshInterval": "1s",
"connectionTimeoutInMs": 5000,
"bulkBufferCapacity": 50000,
"bulkFlushIntervalMs": 100,
"bulkMaxBatchSize": 2500,
"elasticsearchType": "READ_WRITE",
"elasticsearchMajorVersion": "AUTO_DETECT"
}
Request Body Fields​
Common Fields​
FieldTypeRequiredDefaultDescription
typestringYes-Connection type discriminator field. Identifies the connection type in API requests/responses.
namestringYes-Connection name (must match path parameter)
descriptionstringNo-Connection description
enabledbooleanNotrueWhether connection is enabled
Elasticsearch-Specific Fields​
FieldTypeRequiredDefaultDescription
administratebooleanNofalseWhether to administrate Elasticsearch (create/delete indices, templates, policies)
elasticHostListarrayYes-List of Elasticsearch hosts. See ElasticHost
authenticatebooleanNofalseEnable authentication
elasticUsernamestringNo*nullElasticsearch username (required if authenticate=true)
elasticPasswordstringNo*nullElasticsearch password (required if authenticate=true, secret field)
encryptCommunicationbooleanNofalseEnable encrypted communication (HTTPS)
encryptCommunicationTypestringNo*nullEncryption communication type (required if encryptCommunication=true). See EnumEncryptCommunicationType
caCertInPkcs12FilestringNo*nullCA certificate in PKCS12 format (base64-encoded, required if encryptCommunicationType=CA_CERTIFICATE_IN_PKCS_12)
caCertInPkcs12FileContentTypestringNoapplication/x-pkcs12Content type for PKCS12 file
caInPemFilestringNo*nullCA certificate in PEM format (base64-encoded, required if encryptCommunicationType=CA_IN_PEM_FILE)
caInPemFileContentTypestringNoapplication/x-pem-fileContent type for PEM file
caTruststoreFilestringNo*nullCA truststore file (base64-encoded, used with PKCS12)
caTruststoreFileContentTypestringNoapplication/x-pkcs12Content type for truststore file
caTruststoreFilePassstringNonullTruststore file password (secret field)
caKeystoreFilestringNo*nullCA keystore file (base64-encoded, required if encryptCommunicationType=CERT_AND_PRIVATE_KEY_IN_PKCS_12)
caKeystoreFileContentTypestringNoapplication/x-pkcs12Content type for keystore file
caKeystoreFilePassstringNo*nullKeystore file password (required if caKeystoreFile is provided, secret field)
disableHostnameVerificationbooleanNofalseDisable hostname verification (not recommended for production)
indexLifecyclePolicyCreatedbooleanNofalseWhether to create index lifecycle policy
indexLifecyclePolicyobjectNo*nullIndex lifecycle policy configuration (required if indexLifecyclePolicyCreated=true). See ElasticsearchIndexLifecyclePolicy
indexTemplateCreatedbooleanNofalseWhether to create index template
lastStatusCheckFailedbooleanNofalseRead-only in practice: set by the manager's Live Status Check when Elasticsearch could not be asked (unreachable/unauthorized). While true, the *Created flags are the last verified values, not the current cluster state (2026.09.3, APNZ-6344).
indexTemplateNamestringNo*nullIndex template name (required if indexTemplateCreated=true)
indexNamestringNonullIndex name pattern
indexTemplateNumberOfShardsintegerNonullNumber of shards for index template
indexTemplateNumberOfReplicasintegerNonullNumber of replicas for index template
indexTemplateRefreshIntervalstringNonullRefresh interval for index template (e.g., "1s", "5s")
indexTemplateLoadFixedBitsetFiltersEagerlybooleanNonullValue of the static index setting index.load_fixed_bitset_filters_eagerly written into the index template. null keeps the Elasticsearch default (true); false lowers heap usage for nested fields. Static setting — applies only to indices created after the template is pushed again (next rollover).
connectionTimeoutInMsintegerNo5000Connection timeout in milliseconds
bulkBufferCapacityintegerNo50000Maximum number of log entries to buffer before dropping
bulkFlushIntervalMsintegerNo100Interval in milliseconds between bulk flush operations
bulkMaxBatchSizeintegerNo2500Maximum number of documents per bulk request
elasticsearchTypestringNoREAD_WRITEElasticsearch connection type. See EnumElasticsearchType
elasticsearchMajorVersionstringNoAUTO_DETECTElasticsearch major version. See EnumElasticsearchMajorVersion

EnumEncryptCommunicationType​

  • CA_CERTIFICATE_IN_PKCS_12 - CA certificate is available in a PKCS#12 keystore
  • CA_IN_PEM_FILE - CA certificate is available as a PEM encoded file
  • CERT_AND_PRIVATE_KEY_IN_PKCS_12 - Certificate and a private key that are stored in a PKCS#12 keystore

EnumElasticsearchType​

  • READ_WRITE - Read and write access (can create indices, templates, policies)
  • READ - Read-only access (can only query, cannot create/modify)

EnumElasticsearchMajorVersion​

  • AUTO_DETECT - Automatically detect the Elasticsearch version at runtime
  • ES_7 - Elasticsearch 7.x
  • ES_8 - Elasticsearch 8.x
  • ES_9 - Elasticsearch 9.x

Note​

  • elasticHostList must contain at least one host.
  • If authenticate: true, both elasticUsername and elasticPassword are required.
  • If encryptCommunication: true, encryptCommunicationType is required.
  • If encryptCommunicationType: CA_CERTIFICATE_IN_PKCS_12, caCertInPkcs12File is required.
  • If encryptCommunicationType: CA_IN_PEM_FILE, caInPemFile is required.
  • If encryptCommunicationType: CERT_AND_PRIVATE_KEY_IN_PKCS_12, caKeystoreFile and caKeystoreFilePass are required.
  • If indexLifecyclePolicyCreated: true, indexLifecyclePolicy is required.
  • If indexTemplateCreated: true, indexTemplateName is required.

ElasticHost​

FieldTypeRequiredDefaultDescription
schemestringNohttpURL scheme: http or https
hoststringYes-Elasticsearch hostname or IP address
portintegerNo9200Elasticsearch port

Note: At least one host is required in elasticHostList.

ElasticsearchIndexLifecyclePolicy​

FieldTypeRequiredDefaultDescription
policyNamestringNoapinizer-log-ilm-policy-defaultIndex lifecycle policy name
enableHotPhasebooleanNofalseEnable hot phase
maxAgeOfRolloverintegerNonullMaximum age for rollover (in days)
maxIndexSizeOfRolloverintegerNonullMaximum index size for rollover (in GB)
maxDocCountOfRolloverlongNonullMaximum document count for rollover
enableWarmPhasebooleanNofalseEnable warm phase
numberOfReplicasForWarmintegerNonullNumber of replicas for warm phase
maxNumShardsForShrinkintegerNonullMaximum number of shards for shrink
maxNumSegmentsForForceMergeintegerNonullMaximum number of segments for force merge
enableColdPhasebooleanNofalseEnable cold phase
minAgeOfColdintegerNonullMinimum age for cold phase (in days)
numberOfReplicasForColdintegerNonullNumber of replicas for cold phase
enableDeletePhasebooleanNofalseEnable delete phase
minAgeOfDeleteintegerNonullMinimum age for delete phase (in days)

Note​

  • Age values are in days.
  • Size values are in GB.
  • At least one phase must be enabled.

Response​

Success Response (200 OK)​

{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}

cURL Example​

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/connections/my-elasticsearch-connection/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "elasticsearch",
"name": "my-elasticsearch-connection",
"description": "Elasticsearch connection for logging",
"enabled": true,
"administrate": true,
"elasticHostList": [
{
"scheme": "http",
"host": "localhost",
"port": 9200
}
],
"authenticate": false,
"encryptCommunication": false,
"elasticsearchType": "READ_WRITE"
}'

Update Connection​

Endpoint​

PUT /apiops/projects/{projectName}/connections/{connectionName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}
Content-Typeapplication/json

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name (must match name in body)

Request Body​

Full JSON Body Example​
{
"type": "elasticsearch",
"name": "my-elasticsearch-connection",
"description": "Elasticsearch connection for logging",
"enabled": true,
"administrate": true,
"elasticHostList": [
{
"scheme": "http",
"host": "localhost",
"port": 9200
}
],
"authenticate": false,
"elasticUsername": null,
"elasticPassword": null,
"encryptCommunication": false,
"encryptCommunicationType": null,
"caCertInPkcs12File": null,
"caCertInPkcs12FileContentType": null,
"caInPemFile": null,
"caInPemFileContentType": null,
"caTruststoreFile": null,
"caTruststoreFileContentType": null,
"caTruststoreFilePass": null,
"caKeystoreFile": null,
"caKeystoreFileContentType": null,
"caKeystoreFilePass": null,
"disableHostnameVerification": false,
"indexLifecyclePolicyCreated": false,
"indexLifecyclePolicy": null,
"indexTemplateCreated": false,
"indexTemplateName": null,
"indexName": null,
"indexTemplateNumberOfShards": null,
"indexTemplateNumberOfReplicas": null,
"indexTemplateRefreshInterval": null,
"connectionTimeoutInMs": null,
"bulkBufferCapacity": null,
"bulkFlushIntervalMs": null,
"bulkMaxBatchSize": null,
"elasticsearchType": "READ_WRITE",
"elasticsearchMajorVersion": "AUTO_DETECT"
}

Note: Request body structure is the same as Create Connection. All fields should be provided for update.

Response​

Success Response (200 OK)​

{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [...]
}
}

Delete Connection​

Endpoint​

DELETE /apiops/projects/{projectName}/connections/{connectionName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name

Response​

Success Response (200 OK)​

{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [...]
}
}

Notes and Warnings​

  • Elasticsearch Hosts:

    • At least one host is required in elasticHostList
    • Multiple hosts can be specified for high availability
    • Each host must have scheme (http/https), host, and port
  • Authentication:

    • When authenticate: true, both elasticUsername and elasticPassword are required
    • Supports basic authentication
    • Password is stored securely and masked in responses
  • Encryption:

    • encryptCommunication: true enables HTTPS/TLS
    • Three encryption types supported:
      • CA_CERTIFICATE_IN_PKCS_12 - CA certificate in PKCS12 keystore
      • CA_IN_PEM_FILE - CA certificate in PEM file
      • CERT_AND_PRIVATE_KEY_IN_PKCS_12 - Certificate and private key in PKCS12 keystore
    • Certificate files must be base64-encoded
  • Index Lifecycle Management:

    • indexLifecyclePolicyCreated: true creates an ILM policy
    • Supports hot, warm, cold, and delete phases
    • Helps manage index lifecycle automatically
  • Index Templates:

    • indexTemplateCreated: true creates an index template
    • Template defines index settings (shards, replicas, refresh interval)
    • Used for automatic index creation
  • Connection Settings:

    • connectionTimeoutInMs - Connection timeout (default: 5000ms)
    • bulkBufferCapacity - Maximum log entries to buffer (default: 50000)
    • bulkFlushIntervalMs - Bulk flush interval (default: 100ms)
    • bulkMaxBatchSize - Maximum documents per bulk request (default: 2500)
  • Elasticsearch Version:

    • elasticsearchMajorVersion - Set to AUTO_DETECT (default), ES_7, ES_8, or ES_9
    • Auto-detection queries the Elasticsearch cluster at runtime
  • Connection Type:

    • READ_WRITE - Full access (can create indices, templates, policies)
    • READ - Read-only access (query only)
  • Administration:

    • administrate: true allows creating/deleting indices, templates, and policies
    • Requires appropriate Elasticsearch permissions
  • Performance: Connection pooling and timeout settings affect performance. Tune based on workload.

  • Security:

    • Use HTTPS in production
    • Enable authentication
    • Do not disable hostname verification in production
    • Store certificates securely
  • Deployment: Saving the connection deploys it to the workers; the response carries the deployment result.