https://github.com/dev-vivekkumarverma/elastic-search
Hey, I am learning elastic search !
https://github.com/dev-vivekkumarverma/elastic-search
distributed-search distributed-search-engine elasticsearch python3 search
Last synced: 3 months ago
JSON representation
Hey, I am learning elastic search !
- Host: GitHub
- URL: https://github.com/dev-vivekkumarverma/elastic-search
- Owner: dev-vivekkumarverma
- Created: 2025-02-14T03:43:13.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-02-14T10:27:54.000Z (3 months ago)
- Last Synced: 2025-02-14T11:32:20.964Z (3 months ago)
- Topics: distributed-search, distributed-search-engine, elasticsearch, python3, search
- Language: Jupyter Notebook
- Homepage:
- Size: 593 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elastic-Search

## Overview
This repository provides a comprehensive guide to setting up, configuring, and using Elasticsearch effectively with Python 3. It includes best practices, hands-on examples, and real-world use cases to help you leverage Elasticsearch for search, analytics, and data management.## Features
- **Powerful Search Capabilities**: Supports full-text search, fuzzy matching, and relevance scoring.
- **Scalable & Distributed**: Handles large datasets efficiently with horizontal scaling.
- **Real-time Data Processing**: Enables quick indexing and retrieval of structured and unstructured data.
- **Custom Mappings & Analyzers**: Define schemas and optimize search performance.
- **Integration with Kibana & Logstash**: Provides visualization and data processing capabilities.## Getting Started
### Prerequisites
- Python 3.x
- Elasticsearch and `elasticsearch-py` Python client
- Docker (recommended) or direct installation
- Java 11+ (if running without Docker)
- Basic understanding of JSON and RESTful APIs### Installation
#### Using Docker
```bash
docker network create elasticdocker run --name elasticsearch --net elastic -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e "xpack.security.enabled=false" \
docker.elastic.co/elasticsearch/elasticsearch:8.6.2
```
# or
Use the docker compose file and run the following command
```sh
docker-compose -f path/to/docker-compose.yaml up
```
# or [Easiest way]
Use run.sh file
see run.sh file: Link [click me]
```sh
# change the chmod of the run.sh file
chmode +x run.sh
# execute the run.sh file
./run.sh
```
#### Manual Installation
1. [Download Elasticsearch](https://www.elastic.co/downloads/elasticsearch).
2. Extract and navigate to the directory.
3. Run Elasticsearch:
```sh
./bin/elasticsearch
```
4. Access the UI via `http://localhost:9200`.### Installing Elasticsearch Python Client
```bash
pip install elasticsearch
```## Basic Usage with Python
### Connecting to Elasticsearch
```python
from elasticsearch import Elasticsearches = Elasticsearch(["http://localhost:9200"])
print(es.info())
```### Creating an Index
```python
es.indices.create(index="my_index", body={
"settings": {"number_of_shards": 1, "number_of_replicas": 1}
})
```### Indexing a Document
```python
doc = {"title": "Introduction to Elasticsearch", "content": "Elasticsearch is a powerful search and analytics engine."}
es.index(index="my_index", id=1, document=doc)
```### Searching Documents
```python
resp = es.search(index="my_index", query={"match": {"title": "Elasticsearch"}})
print(resp)
```## Folder Structure
```
/elastic-search
├── configs/ # Elasticsearch configurations
├── scripts/ # Custom automation scripts
├── data/ # Sample datasets
├── logs/ # Elasticsearch logs
├── docs/ # Documentation and guides
└── README.md # This file
```## Best Practices
- Use **proper indexing strategies** to improve search efficiency.
- Optimize **queries and filters** to reduce execution time.
- Implement **snapshot and backup mechanisms** to prevent data loss.
- Enable **monitoring and logging** to analyze performance and troubleshoot issues.## Author
👤 **Vivek Kumar Verma**
📧 Contact: [email protected]
🔗 GitHub: https://github.com/dev-vivekkumarverma---
### Happy Searching with Elasticsearch and Python! 🚀For notes and Use : Link [click me...]