# What is Elasticsearch?

## Elasticsearch คืออะไร

Elasticsearch คือ Distributed Data Store ตัวหนึ่งที่พัฒนาต่อยอดมาจาก Apache Lucene มีจุดเด่นในเรื่องความสามารถของการ search แบบเป็น distributed search ที่ทุกๆ filed ของข้อมูลที่เก็บจะถูกทำ index ไว้ ทำให้ความเร็วในการ search กับข้อมูลขนาดมหาศาลแบบ Near Real-time สามารถสรุปข้อมูลขนาดใหญ่ได้อย่างรวดเร็ว  และการติดต่อกับส่วน data store สามารถทำได้โดยผ่าน RESTful API ซึ่งทำให้การอ่านเขียนข้อมูลกับตัว Elasticsearch ทำได้ง่ายมาก

## **ทำไมเราถึงควรเลือกใช้ Elasticsearch?**

### 1. **ทำงานได้รวดเร็ว**

Elasticsearch มีการทำ index ข้อมูลไว้ในทุกๆ field ข้อมูล ทำให้ค้นหาและสรุปข้อมูลข้อมูลขนาดใหญ่ได้อย่างรวดเร็วใกล้เคียงกับการเข้าถึงข้อมูลแบบ Near Real-time ซึ่งช่วยให้คุณใช้ ElasticSearch ได้ในกรณีใช้งานต่างๆ เช่น การติดตามแอปพลิเคชัน และการตรวจหาสิ่งผิดปกติ การมอนิเตอร์

### 2. **เก็บข้อมูลแบบในรูปแบบ JSON Document**

Elasticsearch เลือกใช้การเก็บข้อมูลในรูปแบบ JSON (JavaScript Object Notation) ซึ่งเป็นรูปแบบมาตรฐานข้อมูลที่ใช้งานได้ง่าย รับส่งข้อมูลได้หลากหลายแพลตฟอร์ม และไม่มี schema ช่วยให้เริ่มต้นใช้งานและสร้างแอปพลิเคชันในกรณีใช้งานต่างๆ ได้ง่ายและรวดเร็ว

{% hint style="info" %}
**Schema คือ**โครงสร้างข้อมูลหรือนิยามข้อมูล รวมถึงความสัมพันธ์ของข้อมูลในแต่ละ Entity ว่ามีความสัมพันธ์กันอย่างไร

ตัวอย่าง เช่น ถ้าเรามีตารางข้อมูลของดังนี้
{% endhint %}

| ID | Name | Age |
| -- | ---- | --- |
| 1  | ilog | 26  |

{% hint style="info" %}
โครงสร้างข้อมูล (Schema) ของนักศึกษา คือ
{% endhint %}

| ID | Name | Age         |
| -- | ---- | ----------- |
|    |      | <p><br></p> |

{% hint style="info" %}
Schema เปรียบเสมือนหัวข้อของตาราง
{% endhint %}

### 3. พัฒนาแอปพลิเคชันได้หลากหลาย

ElasticSearch รองรับภาษาต่างๆ รวมถึง Java, Python, PHP, JavaScript, Node.js, Ruby และอื่นๆ

### 4. ใช้งานผ่าน **HTTP API**

ElasticSearch มี REST API ที่ไม่ซับซ้อน อินเทอร์เฟซ HTTP ที่ไม่ซับซ้อน&#x20;

{% hint style="info" %}
Credit : <https://www.webmaster.or.th/articles/development/elasticsearch-101>
{% endhint %}

{% hint style="info" %}
Credit: <https://www.elastic.co/products/elasticsearch>
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ilog.ai/elasticsearch/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
