diff --git a/README.md b/README.md index e6ecc25..0696031 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,8 @@ # elasticsearch-sandbox -Test elasticsearch features & examples. + +Repositório para estudos e testes em geral utilizando as ferramentas da elastic. + +## Material de estudo + +- [Kibana](/kibana/README.md) +- [Python](/python/README.md) \ No newline at end of file diff --git a/kibana/README.md b/kibana/README.md index 548c410..9df3885 100644 --- a/kibana/README.md +++ b/kibana/README.md @@ -1,5 +1,15 @@ # elasticsearch-sandbox kibana +Vamos utilizar o kibana como ferramenta base para os nossos estudos. -Vamos utilizar o kibana para rodar todos os comandos de criação de indices, para criar os documentos e buscar os mesmos. +## Material de estudo +**Iniciando com o elastic search** +- [Indices & Search](/kibana/example1.md) +- [Analyzers & Tokenizers](/kibana/example2.md) + +**Elasticsearch Engineer** +- [Guia de estudos para o exame](/kibana/elastic-engineer/README.md) + +**Tutorias & Palestras** +- [Elasticsearch como máquina de busca - TDC Connections 2021](/kibana/tdc-connections-2021/README.md) diff --git a/kibana/elastic-engineer/DataManagement.md b/kibana/elastic-engineer/DataManagement.md new file mode 100644 index 0000000..93fcfe9 --- /dev/null +++ b/kibana/elastic-engineer/DataManagement.md @@ -0,0 +1,103 @@ +# [elastic-engineer](/kibana/elastic-engineer/README.md) + +Plano de estudos para o [exame de certificação da Elastic](https://www.elastic.co/training/elastic-certified-engineer-exam). +- Versão utilizada 8.1 +- Este material utiliza o Docker para rodar os comandos + +## Data Management +- Define an index that satisfies a given set of requirements +- Define and use an index template for a given pattern that satisfies a given set of requirements +- Define and use a dynamic template that satisfies a given set of requirements +- Define an Index Lifecycle Management policy for a time-series index +- Define an index template that creates a new data stream + +--- + +### Define an index that satisfies a given set of requirements + +#### Criando indices no elasticsearch. + +Documentação oficial: + +- https://www.elastic.co/guide/en/elasticsearch/reference/8.1/indices-create-index.html + + +##### Da forma simples, com mapping, settings e ambos: + +```kibana + +PUT /some-index + +PUT /some-index-mapping +{ + "mappings": { + "properties": { + "field1": { "type": "text" } + } + } +} + +PUT /some-index-settings +{ + "settings": { + "index": { + "number_of_shards": 3, + "number_of_replicas": 2 + } + } +} + +PUT /some-index-mappong-settings +{ + "mappings": { + "properties": { + "field1": { "type": "text" } + } + }, + "settings": { + "index": { + "number_of_shards": 3, + "number_of_replicas": 2 + } + } +} + +GET / +``` + +##### Com aliases: + +- https://www.elastic.co/guide/en/elasticsearch/reference/8.1/indices-add-alias.html + +```kibana + +PUT /some-index-aliases +{ + "aliases": { + "aliases_1": {}, + "aliases_2": { + "filter": { + "term": { "user.id": "kimchy" } + }, + "routing": "shard-1" + } + } +} + + +PUT /some-index-aliases-date-math +{ + "aliases": { + "": {} + } +} +``` + + +### Com diferentes tipos de mapping + +```kibana + + + +``` \ No newline at end of file diff --git a/kibana/elastic-engineer/Docker.md b/kibana/elastic-engineer/Docker.md new file mode 100644 index 0000000..3b1f7a7 --- /dev/null +++ b/kibana/elastic-engineer/Docker.md @@ -0,0 +1,30 @@ +# [elastic-engineer](/kibana/elastic-engineer/README.md) + +Plano de estudos para o [exame de certificação da Elastic](https://www.elastic.co/training/elastic-certified-engineer-exam). +- Versão utilizada 8.1 +- Este material utiliza o Docker para rodar os comandos + +## Docker +- Instalação +- Docker para rodar os comandos + +--- + +## Docker + +### Instalação + +Para instalar o docker em sua máquina, recomendo utilizar seguir os passos da documentação oficial no link https://docs.docker.com/engine/install/. + +### Docker para rodar os comandos + +```bash +docker-compose up -d +``` + +Verificar se tudo esta rodando conforme o esperado: +```bash +docker container ls +``` + +Após verificar que tudo esta rodando, acessar o Kibana atraves da url http://localhost:5601/ \ No newline at end of file diff --git a/kibana/elastic-engineer/README.md b/kibana/elastic-engineer/README.md new file mode 100644 index 0000000..5cb6e6a --- /dev/null +++ b/kibana/elastic-engineer/README.md @@ -0,0 +1,49 @@ +# elastic-engineer + +Plano de estudos para o [exame de certificação da Elastic](https://www.elastic.co/training/elastic-certified-engineer-exam). +- Versão utilizada 8.1 +- Este material utiliza o Docker para rodar os comandos + +## Overview + +### [Docker](/kibana/elastic-engineer/Docker.md) +- Instalação +- Docker para rodar os comandos + +### [Data Management](/kibana/elastic-engineer/DataManagement.md) +- Define an index that satisfies a given set of requirements +- Define and use an index template for a given pattern that satisfies a given set of requirements +- Define and use a dynamic template that satisfies a given set of requirements +- Define an Index Lifecycle Management policy for a time-series index +- Define an index template that creates a new data stream + +### Searching Data +- Write and execute a search query for terms and/or phrases in one or more fields of an index +- Write and execute a search query that is a Boolean combination of multiple queries and filters +- Write an asynchronous search +- Write and execute metric and bucket aggregations +- Write and execute aggregations that contain sub-aggregations +- Write and execute a query that searches across multiple clusters +- Write and execute a search that utilizes a runtime field + +### Developing Search Applications +- Highlight the search terms in the response of a query +- Sort the results of a query by a given set of requirements +- Implement pagination of the results of a search query +- Define and use index aliases +- Define and use a search template + +### Data Processing +- Define a mapping that satisfies a given set of requirements +- Define and use a custom analyzer that satisfies a given set of requirements +- Define and use multi-fields with different data types and/or analyzers +- Use the Reindex API and Update By Query API to reindex and/or update documents +- Define and use an ingest pipeline that satisfies a given set of requirements, including the use of Painless to modify documents +- Define runtime fields to retrieve custom values using Painless scripting + +### Cluster Management +- Diagnose shard issues and repair a cluster's health +- Backup and restore a cluster and/or specific indices +- Configure a snapshot to be searchable +- Configure a cluster for cross-cluster search +- Implement cross-cluster replication \ No newline at end of file diff --git a/kibana/elastic-engineer/docker-compose.yml b/kibana/elastic-engineer/docker-compose.yml new file mode 100644 index 0000000..494f651 --- /dev/null +++ b/kibana/elastic-engineer/docker-compose.yml @@ -0,0 +1,41 @@ +version: "3.9" +services: + ELASTICSEARCH_HOSTS: + image: docker.elastic.co/elasticsearch/elasticsearch:8.1.3 + container_name: elastic-engineer + environment: + - node.name=elastic-engineer + - cluster.name=elastic-engineer-docker-cluster + - discovery.seed_hosts=elastic-engineer + - cluster.initial_master_nodes=elastic-engineer + - bootstrap.memory_lock=true + - xpack.security.enabled=false + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + ulimits: + memlock: + soft: -1 + hard: -1 + volumes: + - es_data:/usr/share/elasticsearch/data + ports: + - 9200:9200 + networks: + - elastic-engineer + + kibana: + image: docker.elastic.co/kibana/kibana:8.1.3 + ports: + - 5601:5601 + environment: + ELASTICSEARCH_URL: http://elastic-engineer:9200 + ELASTICSEARCH_HOSTS: http://elastic-engineer:9200 + networks: + - elastic-engineer + +volumes: + es_data: + driver: local + +networks: + elastic-engineer: + driver: bridge \ No newline at end of file