tencent cloud

Elasticsearch Service

User Guide
Release Notes and Announcements
Release Notes
Product Announcements
Security Announcement
Product Introduction
Overview
Elasticsearch Version Support Notes
Features
Elastic Stack (X-Pack)
Strengths
Scenarios
Capabilities and Restrictions
Related Concepts
Purchase Guide
Billing Overview
Pricing
Elasticsearch Service Serverless Pricing
Notes on Arrears
ES Kernel Enhancement
Kernel Release Notes
Targeted Routing Optimization
Compression Algorithm Optimization
FST Off-Heap Memory Optimization
Getting Started
Evaluation of Cluster Specification and Capacity Configuration
Creating Clusters
Accessing Clusters
ES Serverless Guide
Service Overview
Basic Concepts
5-Minute Quick Experience
Quick Start
Access Control
Writing Data
Data Query
Index Management
Alarm Management
ES API References
Related Issues
Data Application Guide
Data Application Overview
Data Management
Elasticsearch Guide
Managing Clusters
Access Control
Multi-AZ Cluster Deployment
Cluster Scaling
Cluster Configuration
Plugin Configuration
Monitoring and Alarming
Log Query
Data Backup
Upgrade
Practical Tutorial
Data Migration and Sync
Use Case Construction
Index Configuration
SQL Support
Receiving Watcher Alerts via WeCom Bot
API Documentation
History
Introduction
API Category
Instance APIs
Making API Requests
Data Types
Error Codes
FAQs
Product
ES Cluster
Service Level Agreement
Glossary
New Version Introduction
Elasticsearch Service July 2020 Release
Elasticsearch Service February 2020 Release
Elasticsearch Service December 2019 Release

Writing Data

PDF
Focus Mode
Font Size
Last updated: 2024-12-04 16:25:16

Overview

The ES Serverless service supports writing data into indexes through methods such as ES native APIs, Logstash, Flink, and Kafka. If you require log collection for services such as CVM, TKE, or TCHouse-C, a one-stop visualized configuration option is also available. By simply setting up data sources and index information, you can collected logs into the indexes for efficient retrieval and analysis. This document provides instructions for writing a single document and writing document in batches using Kibana and Curl commands.

Access Control

1. In the Project list, click the corresponding project name to enter the Basic Info page.



2. In the Access Control module, you can view the username and password for the index, private network access address, Kibana private network access address, and Kibana public network access address. You can also configure the Kibana public network access policy.

3. Access Kibana: The Discover and Dev Tools features of Kibana are embedded in the Tencent Cloud console, allowing you to use retrieval and analysis capabilities directly within the console or access Kibana via an external link.
Via Console: In the sidebar of the space details page, click Search and Analysis to enter the relevant page. You can switch between index views by clicking the index pattern dropdown on the left side. Log Search corresponds to Discover, and Development Tools corresponds to Dev Tools.
Note:
Embedded features require third-party cookies to be enabled in your browser. If you encounter issues, please enable third-party cookies in your browser settings.

Via Kibana Public Network Access Address: Click Kibana public network access address to enter the Kibana page.

On the Kibana login page, enter the username and password, which can be copied directly from the user management page.

After entering the Kibana page, click the three-bar icon in the upper right corner, then click Dev Tools to enter the development tools page.

Note:
Kibana public network access includes an allowlist mechanism, meaning that IP addresses not included in the access policy cannot access Kibana, enhancing access security. If the page displays Sorry, you do not have permissions to access, click Kibana Public Network Access Policy as shown above. In the pop-up window, click Get current IP to enter your current IP address to the allowlist.


Writing a Single Document

Via Kibana Dev Tools

POST /index name/_doc
{
"@timestamp": "2023-09-28T11:06:07.000Z",
"user":{
"id" : "8a4f500"
},
"message": "Login successful"
}

Via Command Line

curl -X POST "project space access address/index name/_doc/?pretty" -H 'Content-Type: application/json' -d'
{
"@timestamp": "2023-09-28T11:06:07.000Z",
"user": {
"id": "8a4f500d"
},
"message": "Login successful"
}




Caution
The PUT /index name/_doc/document ID format cannot be used for writing requests. To specify a document ID, use PUT /index name/_create/document ID.
Ensure that the written data includes the Time Field set during index creation.

Writing Document in Batches

Via Kibana Dev Tools

PUT /index name/_bulk?refresh
{"create":{ }}
{ "@timestamp": "2023-03-28T11:04:05.000Z", "user": { "id": "vlb44hny" }, "message": "Login attempt failed" }
{"create":{ }}
{ "@timestamp": "2023-03-29T11:06:07.000Z", "user": { "id": "8a4f500d" }, "message": "Login successful" }
{"create":{ }}
{ "@timestamp": "2023-03-30T11:07:08.000Z", "user": { "id": "l7gk7f82" }, "message": "Logout successful" }

Via Command Line

curl -X PUT "project space access address/index name/_bulk?refresh&pretty" -H 'Content-Type: application/json' -d'
{"create":{ }}
{ "@timestamp": "2023-03-28T11:04:05.000Z", "user": { "id": "vlb44hny" }, "message": "Login attempt failed" }
{"create":{ }}
{ "@timestamp": "2023-03-29T11:06:07.000Z", "user": { "id": "8a4f500d" }, "message": "Login successful" }
{"create":{ }}
{ "@timestamp": "2023-03-30T11:07:08.000Z", "user": { "id": "l7gk7f82" }, "message": "Logout successful" }
'
Caution
The bulk operation only supports create.
Ensure that the written data includes the Time Field set during index creation.


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback