Archive for the ‘Elasticsearch Logstash Kibana (ELK Stack)’ Category

Elasticsearch – introduction to searching

Sonntag, Mai 30th, 2021

Common Elastic Stack & Elasticsearch – architectures

Sonntag, Mai 30th, 2021

JSON’s end of file (EOF) expected – everything you need to know

Sonntag, Mai 30th, 2021

JSON Formatter – repair invalid JSON documents

Sonntag, Mai 30th, 2021

jsonrepair

Elasticsearch Tutorial For Beginners – create index add documents and searching

Sonntag, Mai 30th, 2021

root@pve-02-ubuntu-2:~# vi test.json
{ „index“:{„_index“:“schools“, „_type“:“school“, „_id“:“1″ }}
{ „name“:“Central School“, „description“:“CBSE Affiliation“, „street“:“Nagan“, „city“:“paprola“, „state“:“HP“, „zip“:“176115″, „location“:[31.8955385, 76.8380405], „fees“:2000, „tags“:[„Senior
Secondary“, „beautiful campus“], „rating“:“3.5\n„}
{ „index“:{ „_index“:“schools“, „_type“:“school“, „_id“:“2″ }}
{ „name“:“Saint Paul School“, „description“:“ICSE Afiliation“, „street“:“Dawarka“, „city“:“Delhi“, „state“:“Delhi“, „zip“:“110075″,“location“:[28.5733056, 77.0122136], „fees“:5000,“tags“:[„Good F
aculty“, „Great Sports“], „rating“:“4.5\n“ }
{ „index“:{„_index“:“schools“, „_type“:“school“, „_id“:“3″}}
{ „name“:“Crescent School“, „description“:“State Board Affiliation“, „street“:“Tonk Road“, „city“:“Jaipur“, „state“:“RJ“, „zip“:“176114″,“location“:[26.8535922, 75.7923988],“fees“:2500, „tags“:[„
Well equipped labs“], „rating“:“4.5\n„}
Important: the final line of data must end with a newline character \n. Each newline character may be preceded by a carriage return \r. Otherwise, you will get an error:
{
„error“ : {
„root_cause“ : [
{
„type“ : „illegal_argument_exception“,
„reason“ : „The bulk request must be terminated by a newline [\n]“
}
],
„type“ : „illegal_argument_exception“,
„reason“ : „The bulk request must be terminated by a newline [\n]“
},
„status“ : 400
}
root@pve-02-ubuntu-2:~# curl -XPUT „localhost:9200/test/_bulk?pretty“ -H ‚Content-Type: application/json‘ –data-binary @test.json
{
„took“ : 12,
„errors“ : false,
„items“ : [
{
„index“ : {
„_index“ : „schools“,
„_type“ : „school“,
„_id“ : „1“,
„_version“ : 2,
„result“ : „updated“,
„_shards“ : {
„total“ : 2,
„successful“ : 1,
„failed“ : 0
},
„_seq_no“ : 3,
„_primary_term“ : 1,
„status“ : 200
}
},
{
„index“ : {
„_index“ : „schools“,
„_type“ : „school“,
„_id“ : „2“,
„_version“ : 2,
„result“ : „updated“,
„_shards“ : {
„total“ : 2,
„successful“ : 1,
„failed“ : 0
},
„_seq_no“ : 4,
„_primary_term“ : 1,
„status“ : 200
}
},
{
„index“ : {
„_index“ : „schools“,
„_type“ : „school“,
„_id“ : „3“,
„_version“ : 2,
„result“ : „updated“,
„_shards“ : {
„total“ : 2,
„successful“ : 1,
„failed“ : 0
},
„_seq_no“ : 5,
„_primary_term“ : 1,
„status“ : 200
}
}
]
}
root@pve-02-ubuntu-2:~# curl -X GET „localhost:9200/_cat/indices?v&pretty“
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open schools iQOagup7Qv2mcCtN5CDScA 1 1 3 0 9.9kb 9.9kb
yellow open shakespeare rV1bXB_8RGeIdd-zKSX0SQ 1 1 111396 0 19.3mb 19.3mb
yellow open products o5Xg9jLxQh-ZgXbzWQpa0A 1 1 2 0 8.5kb 8.5kb

Elasticsearch Tutorial For Beginners – create index add documents and searching

Samstag, Mai 29th, 2021

root@pve-02-ubuntu-2:~# systemctl status elasticsearch.service
* elasticsearch.service – Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor >
Active: active (running) since Sat 2021-05-29 08:45:04 UTC; 33s ago
Docs: https://www.elastic.co
Main PID: 122 (java)
Tasks: 62 (limit: 4915)
Memory: 1.3G
CGroup: /system.slice/elasticsearch.service
|-122 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkad>
`-483 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/>
May 29 08:44:51 pve-02-ubuntu-2 systemd[1]: Starting Elasticsearch…
May 29 08:45:04 pve-02-ubuntu-2 systemd[1]: Started Elasticsearch.
root@pve-02-ubuntu-2:~# curl http://localhost:9200
{
„name“ : „pve-02-ubuntu-2“,
„cluster_name“ : „elasticsearch“,
„cluster_uuid“ : „4V-Zj5WdRfCW4CXFRcez7Q“,
„version“ : {
„number“ : „7.12.1“,
„build_flavor“ : „default“,
„build_type“ : „deb“,
„build_hash“ : „3186837139b9c6b6d23c3200870651f10d3343b7“,
„build_date“ : „2021-04-20T20:56:39.040728659Z“,
„build_snapshot“ : false,
„lucene_version“ : „8.8.0“,
„minimum_wire_compatibility_version“ : „6.8.0“,
„minimum_index_compatibility_version“ : „6.0.0-beta1“
},
„tagline“ : „You Know, for Search“
}
root@pve-02-ubuntu-2:~# curl -X GET „localhost:9200/_cat/indices?v&pretty“
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
root@pve-02-ubuntu-2:~# curl -XPUT „localhost:9200/test_index?pretty“
{
„acknowledged“ : true,
„shards_acknowledged“ : true,
„index“ : „test_index“
}
root@pve-02-ubuntu-2:~# curl -X GET „localhost:9200/_cat/indices?v&pretty
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open test_index jP-SMavlQ62f5DewdLuNLg 1 1 0 0 208b 208b
root@pve-02-ubuntu-2:~# curl -XDELETE „localhost:9200/test_index?pretty“
{
„acknowledged“ : true
}
root@pve-02-ubuntu-2:~# curl -XPUT „localhost:9200/products/mobiles/1?pretty“ -H ‚Content-Type: application/json‘ -d‘
> {
> „name“: „iPhone“,
> „camera“: „12MP“
> }
> ‚
{
„_index“ : „products“,
„_type“ : „mobiles“,
„_id“ : „1“,
„_version“ : 1,
„result“ : „created“,
„_shards“ : {
„total“ : 2,
„successful“ : 1,
„failed“ : 0
},
„_seq_no“ : 0,
„_primary_term“ : 1
}
root@pve-02-ubuntu-2:~# curl -X GET „localhost:9200/_cat/indices?v&pretty
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open test_index jP-SMavlQ62f5DewdLuNLg 1 1 0 0 208b 208b
yellow open products o5Xg9jLxQh-ZgXbzWQpa0A 1 1 1 0 4.4kb 4.4kb
root@pve-02-ubuntu-2:~# curl -XPUT „localhost:9200/products/mobiles/2?pretty“ -H ‚Content-Type: application/json‘ -d‘
> {
> „name“: „iPhone“,
> „camera“: „24MP“
> }
>
{
„_index“ : „products“,
„_type“ : „mobiles“,
„_id“ : „2“,
„_version“ : 1,
„result“ : „created“,
„_shards“ : {
„total“ : 2,
„successful“ : 1,
„failed“ : 0
},
„_seq_no“ : 1,
„_primary_term“ : 1
}
root@pve-02-ubuntu-2:~# curl -X GET „localhost:9200/_cat/indices?v&pretty“
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open test_index jP-SMavlQ62f5DewdLuNLg 1 1 0 0 208b 208b
yellow open products o5Xg9jLxQh-ZgXbzWQpa0A 1 1 2 0 8.5kb 8.5kb
root@pve-02-ubuntu-2:~# curl -XGET „localhost:9200/products/_search?pretty“ -H ‚Content-Type: application/json‘ -d‘
{
„query“: {
„match_phrase“: {
„camera“: „24MP“
}
}
}

{
„took“ : 47,
„timed_out“ : false,
„_shards“ : {
„total“ : 1,
„successful“ : 1,
„skipped“ : 0,
„failed“ : 0
},
„hits“ : {
„total“ : {
„value“ : 1,
„relation“ : „eq“
},
„max_score“ : 0.6931471,
„hits“ : [
{
„_index“ : „products“,
„_type“ : „mobiles“,
„_id“ : „2“,
„_score“ : 0.6931471,
„_source“ : {
„name“ : „iPhone“,
„camera“ : „24MP“
}
}
]
}
}
root@pve-02-ubuntu-2:~# curl -XGET „localhost:9200/products/_search?pretty“ -H ‚Content-Type: application/json‘ -d‘
{
„query“: {
„match_phrase“: {
„camera“: „12MP“
}
}
}

{
„took“ : 1,
„timed_out“ : false,
„_shards“ : {
„total“ : 1,
„successful“ : 1,
„skipped“ : 0,
„failed“ : 0
},
„hits“ : {
„total“ : {
„value“ : 1,
„relation“ : „eq“
},
„max_score“ : 0.6931471,
„hits“ : [
{
„_index“ : „products“,
„_type“ : „mobiles“,
„_id“ : „1“,
„_score“ : 0.6931471,
„_source“ : {
„name“ : „iPhone“,
„camera“ : „12MP“
}
}
]
}
}

root@pve-02-ubuntu-2:~# curl -XPUT „localhost:9200/shakespeare/_bulk?pretty“ -H ‚Content-Type: application/json‘ –data-binary @shakespeare_6.0.json
root@pve-02-ubuntu-2:~# curl -X GET „localhost:9200/_cat/indices?v&pretty“
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open shakespeare rV1bXB_8RGeIdd-zKSX0SQ 1 1 111396 0 19.3mb 19.3mb
yellow open test_index jP-SMavlQ62f5DewdLuNLg 1 1 0 0 208b 208b
root@pve-02-ubuntu-2:~# curl -XGET „localhost:9200/shakespeare/_search?pretty“ -H ‚Content-Type: application/json‘ -d‘
{
„query“: {
„match_phrase“: {
„text_entry“: „So shaken as we are“
}
}
}

{
„took“ : 13,
„timed_out“ : false,
„_shards“ : {
„total“ : 1,
„successful“ : 1,
„skipped“ : 0,
„failed“ : 0
},
„hits“ : {
„total“ : {
„value“ : 1,
„relation“ : „eq“
},
„max_score“ : 21.60624,
„hits“ : [
{
„_index“ : „shakespeare“,
„_type“ : „_doc“,
„_id“ : „3“,
„_score“ : 21.60624,
„_source“ : {
„type“ : „line“,
„line_id“ : 4,
„play_name“ : „Henry IV“,
„speech_number“ : 1,
„line_number“ : „1.1.1“,
„speaker“ : „KING HENRY IV“,
„text_entry“ : „So shaken as we are, so wan with care,“
}
}
]
}
}

Elasticsearch Tutorial – querying data

Donnerstag, Mai 20th, 2021

Elasticsearch Tutorial – insert update deleting data

Donnerstag, Mai 20th, 2021

Elasticsearch Tutorial For Beginners – start with the installation on Ubuntu LinuxContainer (LXC) in Proxmox

Mittwoch, Mai 19th, 2021
root@pve-02:~# pveam update
update successful
root@pve-02:~# pveam available
root@pve-02:~# pveam download local ubuntu-20.04-standard_20.04-1_amd64.tar.gz
root@pve-02-ubuntu-2:~# apt-get update -y
root@pve-02-ubuntu-2:~# apt-get full-upgrade -y

 

root@pve-02-ubuntu-2:~# wget -qO – https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add –
OK
root@pve-02-ubuntu-2:~# apt-get install apt-transport-https
root@pve-02-ubuntu-2:~# echo „deb https://artifacts.elastic.co/packages/7.x/apt stable main“ | tee -a /etc/apt/sources.list.d/elastic-7.x.list
deb https://artifacts.elastic.co/packages/7.x/apt stable main
root@pve-02-ubuntu-2:~# apt-get install elasticsearch
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
elasticsearch
0 upgraded, 1 newly installed, 0 to remove and 139 not upgraded.
Need to get 326 MB of archives.
After this operation, 543 MB of additional disk space will be used.
Get:1 https://artifacts.elastic.co/packages/7.x/apt stable/main amd64 elasticsearch amd64 7.12.1 [326 MB]
Fetched 326 MB in 29s (11.2 MB/s)
Selecting previously unselected package elasticsearch.
(Reading database … 17774 files and directories currently installed.)
Preparing to unpack …/elasticsearch_7.12.1_amd64.deb …
Creating elasticsearch group… OK
Creating elasticsearch user… OK
Unpacking elasticsearch (7.12.1) …
Setting up elasticsearch (7.12.1) …
Created elasticsearch keystore in /etc/elasticsearch/elasticsearch.keystore
Processing triggers for systemd (245.4-4ubuntu3) …
root@pve-02-ubuntu-2:~# /bin/systemctl daemon-reload
root@pve-02-ubuntu-2:~# /bin/systemctl enable elasticsearch.service
Synchronizing state of elasticsearch.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable elasticsearch
Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service -> /usr/lib/systemd/system/elasticsearch.service.
root@pve-02-ubuntu-2:~# /bin/systemctl daemon-reload
root@pve-02-ubuntu-2:~# /bin/systemctl enable elasticsearch.service
Synchronizing state of elasticsearch.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable elasticsearch
Created symlink /etc/systemd/system/multi-user.target.wants/elasticsearch.service -> /usr/lib/systemd/system/elasticsearch.service.
root@pve-02-ubuntu-2:~# systemctl start elasticsearch.service
root@pve-02-ubuntu-2:~# apt-get install curl
root@pve-02-ubuntu-2:~# curl http://localhost:9200
{
„name“ : „pve-02-ubuntu-2“,
„cluster_name“ : „elasticsearch“,
„cluster_uuid“ : „4V-Zj5WdRfCW4CXFRcez7Q“,
„version“ : {
„number“ : „7.12.1“,
„build_flavor“ : „default“,
„build_type“ : „deb“,
„build_hash“ : „3186837139b9c6b6d23c3200870651f10d3343b7“,
„build_date“ : „2021-04-20T20:56:39.040728659Z“,
„build_snapshot“ : false,
„lucene_version“ : „8.8.0“,
„minimum_wire_compatibility_version“ : „6.8.0“,
„minimum_index_compatibility_version“ : „6.0.0-beta1“
},
„tagline“ : „You Know, for Search“
}

Elasticsearch Tutorial For Beginners – Architecture Overview

Dienstag, Mai 18th, 2021

Elasticsearch Tutorial For Beginners – start with the installation on CentOS

Dienstag, Mai 18th, 2021

Docker Official Images – Elasticsearch is a powerful open source search and analytics engine that makes data easy to explore

Dienstag, Mai 18th, 2021

   Elasticsearch – is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases as the heart of the Elastic Stack it centrally stores your data so you can discover the expected and uncover the unexpected

https://hub.docker.com/_/elasticsearch

# docker network create somenetwork
# docker run -d –name elasticsearch –net somenetwork -p 9200:9200 -p 9300:9300 -e „discovery.type=single-node“ elasticsearch:tag