Elasticsearch: 인덱싱과 검색
분산 검색 및 분석 엔진인 Elasticsearch의 기본 개념을 배웁니다. 문서를 인덱싱하고 기본 쿼리를 실행하는 방법을 이해합니다.
Elasticsearch: 인덱싱과 검색은(는) CoddyKit의 무료 System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry) 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry) 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry) 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Welcome to Elasticsearch!
Welcome to the first lesson on the ELK Stack! We'll start with Elasticsearch, the 'E' in ELK.
Elasticsearch is a powerful, open-source distributed search and analytics engine. It's designed to store, search, and analyze large volumes of data quickly.
- Distributed: Runs across multiple servers.
- Real-time: Data is available for search almost instantly.
- Scalable: Easily handles growing data needs.
Data as JSON Documents
Elasticsearch stores data as JSON documents. Think of a document as a single record, like a row in a database, but more flexible.
Each document is a collection of fields (key-value pairs) and can contain various data types, including text, numbers, dates, and even other JSON objects.
Here's a simple example of a document:
{"user": "alice", "message": "Hello CoddyKit!"}Understanding Indices
In Elasticsearch, documents are organized into indices. An index is like a database in a relational database system, or a collection in a NoSQL database.
You can have multiple indices, and each index can store documents that are somewhat related. For example, you might have one index for 'logs' and another for 'products'.
- An index is a logical namespace.
- It groups similar documents.
- You search within specific indices.
Indexing Your First Document
Indexing is the process of adding or updating documents in an Elasticsearch index. When you index a document, Elasticsearch stores it and makes it searchable.
Each document needs a unique ID within its index. If you don't provide one, Elasticsearch will generate it for you.
We use HTTP API calls, typically with PUT or POST requests, to interact with Elasticsearch.
Indexing a Document Example
Let's index a simple log document into an index called my_logs. We'll specify an ID of 1.
Try running this command (assuming Elasticsearch is running on localhost:9200):
curl -X PUT "localhost:9200/my_logs/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
"timestamp": "2023-10-27T10:00:00Z",
"level": "info",
"message": "Application started successfully"
}'Retrieving Documents by ID
Once a document is indexed, you can retrieve it using its unique ID. This is useful when you know exactly which document you want.
To retrieve a document, you send an HTTP GET request to the specific index and document ID endpoint.
This operation is very fast as Elasticsearch can directly fetch the document.
Retrieving a Document Example
Let's retrieve the document we just indexed with ID 1 from the my_logs index.
Run this command to see the stored document:
curl -X GET "localhost:9200/my_logs/_doc/1?pretty"Introduction to Searching
The real power of Elasticsearch comes from its searching capabilities. Instead of knowing an ID, you often want to find documents based on their content.
You can search across all documents in an index (or multiple indices) using various query types. Elasticsearch uses a query language based on JSON.
- Find documents by keywords.
- Filter by date ranges or specific values.
- Combine multiple search criteria.
Basic Search: Match All
The simplest search query is the match_all query. It returns all documents in the specified index.
This is often used to verify that documents are indexed correctly or as a starting point for more complex queries.
You send an HTTP GET request to the _search endpoint of your index.
Match All Query Example
Let's search for all documents in our my_logs index. You'll see the document we indexed earlier.
Run this command:
curl -X GET "localhost:9200/my_logs/_search?pretty" -H 'Content-Type: application/json' -d'
{
"query": {
"match_all": {}
}
}'Quick Check on Indexing
You've learned about documents, indices, and how to index and retrieve data. Let's test your understanding of indexing.
Recap: Indexing and Basic Search
Great job! In this lesson, you've learned the fundamentals of Elasticsearch:
- Elasticsearch is a distributed search and analytics engine.
- Data is stored as JSON documents.
- Documents are organized into indices.
- Indexing adds or updates documents using
PUT/POSTrequests. - Documents can be retrieved by ID using
GETrequests. - Basic searching can be done with queries like
match_all.
Next, we'll dive deeper into Logstash, the 'L' in ELK, to ingest and process data!
자주 묻는 질문
“Elasticsearch: 인덱싱과 검색” 강의는 무료인가요?
네 — “Elasticsearch: 인덱싱과 검색” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry) 강의 전체를 잠금 해제할 수 있습니다. System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry) 강의에는 총 4개의 강의가 포함되어 있습니다.
“Elasticsearch: 인덱싱과 검색”에서 뭘 배우나요?
분산 검색 및 분석 엔진인 Elasticsearch의 기본 개념을 배웁니다. 문서를 인덱싱하고 기본 쿼리를 실행하는 방법을 이해합니다. 브라우저에서 직접 실행하는 실습 코드로 System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry)은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.
“Elasticsearch: 인덱싱과 검색” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry) 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 System Observability: Logging, Metrics & Tracing (ELK + OpenTelemetry) 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- Elasticsearch: 인덱싱과 검색
- Logstash: 데이터 수집과 처리
- Kibana: 시각화와 대시보드
- Beats: 경량 데이터 전송 도구