1. What is kibana?
Kibana is an open source analysis and visualization platform for Elasticsearch, which is used to search and view data interactively stored in the Elasticsearch index. Using Kibana, you can perform advanced data analysis and display through various charts.
Kibana makes big data easier to understand. It is easy to operate, and the browser-based user interface can quickly create a dashboard
(dashboard) to display Elasticsearch query dynamics in real time.
2. Kibana installation
First, root permission is required, and a kibana folder is created during mkdir.
su root
mkdir /usr/local/kibana
Transfer to Linux with Xftp.
Then decompress. Go to the transmission folder, find the tar package and decompress it.
tar -zxvf kibana-7.4.0-linux-x86_64.tar.gz -C /usr/local/kibana
3. Modify kibana configuration
sudo vi /usr/local/kibana/kibana-7.4.0-linux-x86_64/config/kibana.yml
You can modify these five places: enter vim, then click i to operate, save wq!
Do not close the previous es service, it needs to be used here, just close it and open it directly.
4. Start kibana
It is not recommended to use the root user to start here, if you want to use the root user, you need to add the --allow-root parameter.
cd /usr/local/kibana/kibana-7.4.0-linux-x86_64/bin
./kibana --allow-root
The startup is successful, and there are warnings to ignore.
5. Access kibana
192.168.179.128:5601/
You need to pay attention to the ip of your own virtual machine, and then the port is 5601.
Click dev tools on the left side of the main page
6. Elasticsearch concept
Index (index)
The place where ElasticSearch stores data can be understood as the database concept in a relational database.
Mapping (mapping)
Mapping defines the type of each field, the tokenizer used by the field, and so on. It is equivalent to the table structure in relational database.
Document (document)
The smallest data unit in Elasticsearch, often displayed in json format. A document is equivalent to a row of data in a relational database.
Inverted Index
An inverted index consists of a list of all unique words in a document, and for each word there is a list of document ids that contain it.
Type (type)
A type is like a class of tables. Such as user table, role table, etc. In Elasticsearch7.X, the default type is _doc
7. Operation
(1) Create an index
PUT student
GET /student/_mapping
(2) Create a mapping
PUT /student/_mapping
{
"properties":{
"name":{
"type":"text"
},
"age":{
"type":"integer"
}
}
}
GET /student/_mapping
(3) Add document, specify id
POST /student/_doc/1
{
"name":"曹俊",
"age":24
}
GET /student/_doc/1
Add document without specifying id
POST /student/_doc
{
"name":"谭咏麟",
"age":55
}
query all documents
GET /student/_search
GET /student/_doc/_o4ZqIcBhbyZEPhCCkXJ
(4) Delete the document
DELETE /student/_doc/1
GET /student/_search
Query all documents and find that they have been deleted.
{
"took" : 811,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "student",
"_type" : "_doc",
"_id" : "_o4ZqIcBhbyZEPhCCkXJ",
"_score" : 1.0,
"_source" : {
"name" : "谭咏麟",
"age" : 55
}
}
]
}
}