Elastic Search Basic
Introduction : Elasticsearch is a real-time distributed and open source full-text search and analytics engine. It is accessible from Restful web service interface and uses schema less JSON (JavaScript Object Notation) documents to store data. It is built on Java programming language and hence Elasticsearch can run on different platforms. It enables users to explore very large amount of data at very high speed.
Advantages of Elasticsearch
- BUILT ON TOP OF LUCIENNE – Being built on top of Lucienne, it offers the most powerful full-text search capabilities.It makes it very faster also.
- DOCUMENT-ORIENTED – It stores complex entities as structured JSON documents and indexes all fields by default, providing a higher performance.
- SCHEMA FREE – It stores a large quantity of semi-structured (JSON) data in a distributed fashion. It also attempts to detect the data structure, index the data present and makes it search-friendly.
- FULL TEXT SEARCH – Elasticsearch performs linguistic searches against documents and returns the documents that matches the search condition. Result relevancy for the given query is calculated using TF/IDF algorithm.
- FULL TEXT SEARCH – Elasticsearch performs linguistic searches against documents and returns the documents that matches the search condition. Result relevancy for the given query is calculated using TF/IDF algorithm.
- RESTFUL API – Elasticsearch supports REST API which is light-weight protocol. We can query Elasticsearch using the REST API with Chrome plug-in Sense. Sense provides a simple user interface. Sense plugin has features like autocomplete Elasticsearch query syntax, copying the query as cURL command.
- Cluster: A cluster is a collection of nodes that shares data.
- Node: A node is a single server that is part of the cluster, stores the data, and participates in the cluster’s indexing and search capabilities.
- Index: An index is a collection of documents with similar characteristics. An index is more equivalent to a schema in RDBMS.
- Type: There can be multiple types within an index. For example, an ecommerce application can have used products in one type and new products in another type of the same index. One index can have multiple types as multiple tables in one database.
- Document: A document is a basic unit of information that can be indexed. It is like a row in a table.
- Shards and Replicas: Elastic Search indexes are divided into multiple pieces called shards, which allows the index to scale horizontally. Elastic Search also allows us to make copies of index shards, which are called replicas.
It returns the document with the id 1 and some metadata about the document.
Deleting a Document:
This API allows us to delete a JSON document from an index.
curl -XDELETE ‘localhost:9200/patient/outpatient/1?pretty’
This command deletes the JSON document with the id 1.
In order to delete a document that matches a specific condition we can use _delete_by_query API.
curl -XPOST ‘localhost:9200/patient/_delete_by_query?pretty’ -H ‘Content-Type: application/json’ -d’
{
“query”: {
“match”: { “city”: “California” }
}
}’
No comments:
Post a Comment