-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfiguring Elastic search
61 lines (43 loc) · 1.31 KB
/
Configuring Elastic search
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
1. Installation
Run the following commands to download and setup elastic search on the system
sudo apt-get update
wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/6.2.4/elasticsearch-6.2.4.deb
sudo dpkg -i elasticsearch-6.2.4.deb
sudo systemctl enable elasticsearch.service
2. Configuring Elasticsearch
Go to /etc/elasticsearch directory and open elasticsearch.yml file.
Configure node name, cluster names, path to the data. Set node.host to 0.0.0.0.
After configuring, run "sudo systemctl restart elasticsearch"
Check the status of elastic search using the following command:
curl -X GET 'http://localhost:9200'
3. Create Index
Send a POST request to the elastic search using the following URL with the given request body
URL: host-ip:9200/indiastates
Request Body:
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"doc": {
"properties": {
"Name": {
"type": "keyword"
},
"Population": {
"type": "integer"
}
}
}
}
}
4. Create and update documents
Once the index is created, you can create or update documents in this index by sending a POST request.
Eg:
URL: host-ip:9200/indiastates/doc/dl
Request Body:
{
"Name": "Chhattisgarh",
"Count": 77578
}