Installing Elastic Search
- Used instructions from here to install elastic search
- Elastic search by default is configured to run on 9200. Try accessing http://<public ip>:9200
- To fix this lets change configuration in /etc/elasticsearch/elasticsearch.yml
- To know complete information about configuration files Refer Here
- For network.host setting Refer Here
- Basic Elastic search settings are configured to work with localhost, if you need make them work on production, focus on network configurations first.
Lets install Kibana on the same server
- Used Instructions From here to install kibana
- Since we configured repository on this machine already, directly execute command
sudo apt-get update && sudo apt-get install kibana
- Lets change the configuration of kibana (/etc/kibana/kibana.yml)
- Restart kibana after changing configurations and navigate to http://<publicip>:5601
- Naviagate to DevTools
- Console in the DevTools will be our playground to understand elastic search concepts
- Here we have simply sent the GET / query. This is equivalent to curl command that we send to Elastic search for testing the setup
curl http://<elasticsearchipaddress>:9200
Core Concepts of Elastic Search
-
We need the understand the following core abstractions
- Indexes
- Types
- Documents
- Clusters
- Nodes
- Shards and replicas
- Mappings and types
- Inverted Indexes
-
Lets Execute the following in the Kibana Dev Console
PUT /catalog/_doc/1
{
"title": "Linux Bible, 9th Edition",
"author": "Christopher Negus",
"ISBN": "978-1-118-99987-5",
"price": 50,
"pages": 912,
"pubished_date": "april 2015"
}
- To understand what has happened in the above image, lets try to understand core abstractions
Index
- An index is a container that stores and manages document of single type in Elastic.
- Concept of index in Elastic Search is almost equivalent to the database in relational database. However consider index as one database with only one table with multiple records.
- Index is logical container of Type. and Type will be logical collections records of the type defined
- Database = Index Table = Type Records = Documents (Json)
- From Elastic Search 7.0 one index can contain only one type, attempting add one more type in into index will create error.