Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does elasticsearch work?

How does Elasticsearch handle indices? I have a field called Coordinates which has subfields lat and lng in a collection called users. I want to search inside this collection but by indexing the coordinate field. In my MongoDB configuration the coordinate field is already a 2D index. How can I try to tell ElasticSearch to search indexing that field? Does it know that coordinates is an index ? or should I tell it by this script?

curl -XPUT "localhost:9200/_river/artist/_meta" -d'
{
  "type": "mongodb",
    "mongodb": {
      "db": "mydb", 
      "collection": "users"
    },
    "index": {
      "name": "coordin", 
      "type": "coordinates"
    }
}'
like image 737
Aysennoussi Avatar asked Jan 23 '14 14:01

Aysennoussi


People also ask

How does Elasticsearch work with a search?

Elasticsearch uses a data structure called an inverted index, which is designed to allow very fast full-text searches. An inverted index lists every unique word that appears in any document and identifies all of the documents each word occurs in.

How does Elasticsearch query work internally?

Elasticsearch works by retrieving and managing document-oriented and semi-structured data. Internally, the basic principle of how Elasticsearch works is the “shared nothing” architecture. The primary data structure Elasticsearch uses is an inverted index managed using Apache Lucene's APIs.

How does Elasticsearch work fast?

Elasticsearch is fast.Because Elasticsearch is built on top of Lucene, it excels at full-text search. Elasticsearch is also a near real-time search platform, meaning the latency from the time a document is indexed until it becomes searchable is very short — typically one second.

How does Elasticsearch receive data?

Elasticsearch provides a flexible RESTful API for communication with client applications. REST calls are therefore used to ingest data, perform search and data analytics, as well as to manage the cluster and its indices. Under the hood, all of the described methods rely on this API to ingest data into Elasticsearch.


1 Answers

I assume that here by "index" you mean like the ones at MongoDB and SQL server. At elasticsearch context it is a collection of types and documents, more like a database is a collection of tables and rows. By default all fields in elasticsearch are stored into a Lucene data structure from which it can be efficiently be queried.

Elasticsearch does support indexed geospatial data, documentation can be found from here.

like image 125
NikoNyrh Avatar answered Sep 17 '22 17:09

NikoNyrh