Ana içeriğe atla

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

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/" \
  -H "Authorization: Bearer YOUR_TOKEN"

Get Connection

Endpoint

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

Request

Headers

HeaderValue
AuthorizationBearer

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",
      "deployToWorker": true,
      "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,
      "indexTemplateName": "apinizer-log-template",
      "indexName": "apinizer-logs",
      "indexTemplateNumberOfShards": 1,
      "indexTemplateNumberOfReplicas": 1,
      "indexTemplateRefreshInterval": "1s",
      "connectionTimeoutInMs": 5000,
      "socketReuseAddress": true,
      "socketKeepAlive": true,
      "ioThreads": 1,
      "maxConnectionPerHost": 10,
      "maxConnectionTotal": 20,
      "type": "READ_WRITE"
    }
  ],
  "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
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",
  "deployToWorker": true,
  "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,
  "socketReuseAddress": null,
  "socketKeepAlive": null,
  "ioThreads": null,
  "maxConnectionPerHost": null,
  "maxConnectionTotal": null,
  "type": "READ_WRITE"
}
Full JSON Body Example - With Authentication
{
  "type": "elasticsearch",
  "name": "my-elasticsearch-connection",
  "description": "Elasticsearch connection with authentication",
  "deployToWorker": true,
  "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,
  "type": "READ_WRITE"
}
Full JSON Body Example - With Encryption (PKCS12)
{
  "type": "elasticsearch",
  "name": "my-elasticsearch-connection",
  "description": "Elasticsearch connection with PKCS12 encryption",
  "deployToWorker": true,
  "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,
  "type": "READ_WRITE"
}
Full JSON Body Example - With Encryption (PEM)
{
  "type": "elasticsearch",
  "name": "my-elasticsearch-connection",
  "description": "Elasticsearch connection with PEM encryption",
  "deployToWorker": true,
  "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,
  "type": "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",
  "deployToWorker": true,
  "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,
  "socketReuseAddress": true,
  "socketKeepAlive": true,
  "ioThreads": 1,
  "maxConnectionPerHost": 10,
  "maxConnectionTotal": 20,
  "type": "READ_WRITE"
}
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
deployToWorkerbooleanNotrueWhether to deploy to worker
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
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”)
connectionTimeoutInMsintegerNonullConnection timeout in milliseconds
socketReuseAddressbooleanNonullReuse socket address
socketKeepAlivebooleanNonullKeep socket alive
ioThreadsintegerNonullNumber of IO threads
maxConnectionPerHostintegerNonullMaximum connections per host
maxConnectionTotalintegerNonullMaximum total connections
typestringNoREAD_WRITEElasticsearch connection type. See EnumElasticsearchType

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)

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",
    "deployToWorker": true,
    "enabled": true,
    "administrate": true,
    "elasticHostList": [
      {
        "scheme": "http",
        "host": "localhost",
        "port": 9200
      }
    ],
    "authenticate": false,
    "encryptCommunication": false,
    "type": "READ_WRITE"
  }'

Update Connection

Endpoint

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

Request

Headers

HeaderValue
AuthorizationBearer
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",
  "deployToWorker": true,
  "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,
  "socketReuseAddress": null,
  "socketKeepAlive": null,
  "ioThreads": null,
  "maxConnectionPerHost": null,
  "maxConnectionTotal": null,
  "type": "READ_WRITE"
}
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

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
    • socketReuseAddress, socketKeepAlive - Socket options
    • ioThreads - Number of IO threads
    • maxConnectionPerHost, maxConnectionTotal - Connection pool limits
  • 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: Connection changes require deployment to take effect. Set deployToWorker: true or deploy manually.