View
143
Download
0
Category
Preview:
Citation preview
1
Thiago SouzaSupport Engineer @ Elastic
Elasticsearch 5.0
2
Elasticsearch 5.0Um pouco sobre mim
• Desenvolvedor há mais de 10 anos
• Utilizo o Elasticsearch desde 2010 (em produção desde v0.90.0)
• Recentemente iniciei como Support Engineer na Elastic
3
Elastic Overview
70,000+CommunityMembers
estatísticas desde 2012, quando a empresa foi criada
70M+Products
Downloads
2,400+SubscriptionCustomers
We aim to help you make your data usable in real time to power mission critical applications that solve today’s real problems
44
Global Customer Base
Tech
Finance
Telco
Consumer
5
Elasticsearch is an Open Source (Apache 2),
Distributed, RESTful, Search Engine built on top of Lucene.
http://www.elasticsearch.org - 2011
6
Apache LuceneTM is a high-performance, full-featured text
search engine library written entirely in Java.
https://lucene.apache.org/core
7
• Full-featured text search engine
• Library written entirely in Java.
‒Uma biblioteca Java off-line, acessada localmente.
Elasticsearch 5.0Apache Lucene: Full Text Search
Id Texto Ids Termo
1 Amanhã vai chover no Rio de Janeiro 1 amanha
2 Rio de Janeiro tem muita praia! 1 chov
2 praia
1,2 rio
...
Inverted Index
8
• Full-featured text search engine
• Library written entirely in Java.
‒Uma biblioteca Java off-line, acessada localmente.
Elasticsearch 5.0Apache Lucene: Full Text Search
Id Texto Ids Termo
1 Amanhã vai chover no Rio de Janeiro 1 amanha
2 Rio de Janeiro tem muita praia! 1 chov
2 praia
1,2 rio
...
Inverted Index"Amanhã" => "amanha"
"chover" => "chov"
9
Elasticsearch 5.0Apache Lucene: Aggregations
Orientado a Tuplas Orientado a Colunas
id Nome Idade Peso id Nome Idade Peso
1 João 34 811 João 34 81
X
2 Maria 51 652 Maria 51 65
3 José 53 763 José 53 76
Agregações mais rápidas AVG(Idade) = 46 SUM(Peso) = 222
10
Elasticsearch 5.0Elasticsearch
$ curl -XPOST 'localhost:9200/twitter/tweet/' -d '{ "user" : "kimchy", "post_date" : "2009-11-15T14:12:12", "message" : "trying out Elasticsearch"}'
HTTP + JSON
Um index no Elasticsearch é composto por 1 ou mais shards e cada shard com 0 ou mais réplicas
11
Elasticsearch 5.0Elasticsearch: v0.90.0 (2013)
• Alta Disponibilidade
• Escalabilidade Horizontal
• API RESTful
• Busca Full Text
• Busca Multifaceted:‒Term‒Histogram‒Range‒etc...
12
13
Elasticsearch 5.0Elastic Stack 5.0
• Nova identidade visual
• Release unificado
• X-Pack: Pacote de Plugins
14
1515
Segurança
Elasticsearch 5.0Elasticsearch
● Java Security Manager para plugins.● Sandboxed Scripting (Painless).● Verificação de Jarhell.● Suporte a Site plugins removido.
1616
Apache Lucene 6.0Muda fundamentalmente como números são tratados. Lucene 6.0 guarda dados
numéricos em uma estrutura chamada k-dimensional tree.
Na prática, isso significa que, se tratando de números:
Elasticsearch 5.0Elasticsearch
● Ocupa metade do espaço em disco e também requer menos memória.
● Indexação 2x mais rápida.● Busca 25% mais rápida.● Permite suporte a números gigantes
como IPv6.
https://www.elastic.co/blog/lucene-points-6.0
1717
Apache Lucene 6.0Fundamentalmente muda o algoritmo de scoring.
Lucene 6.0 utiliza o algoritmo Okapi BM25 para ordenação por relevância. Antes era TF-IDF.
Elasticsearch 5.0Elasticsearch
1818
Apache Lucene 6.0Fundamentalmente muda o algoritmo de scoring.
Lucene 6.0 utiliza o algoritmo Okapi BM25 para ordenação por relevância. Antes era TF-IDF.
Elasticsearch 5.0Elasticsearch
https://www.elastic.co/elasticon/conf/2016/sf/improved-text-scoring-with-bm25
1919
Wait-For-Refresh
O novo recurso Wait-For-Refresh vai permitir que uma operação de escrita bloqueie o retorno até que o próximo refresh regular aconteça.
Elasticsearch 5.0Elasticsearch
PUT my-type/my-type/my-id?refresh=true /** <= forces a refresh **/ { "foo" : "bar"}
PUT my-type/my-type/my-id?refresh=wait_for /** <= blocks until next refresh **/ { "foo" : "bar"}
2020
Elasticsearch 5.0Elasticsearch
Index ShrinkingPermite reduzir o número de shards de um index.
POST my-source-index/_shrink/my-target-index /** target index must not exist!! **/ { "settings" : { "index.number_of_shards" : 1, "index.number_of_replicas" : 0 "index.codec" : "best_compression" }}
2121
● Restrição 1: O número de shards menor tem que ser um fator do número de shards maior. Exemplos:
– Um index com 8 shards pode ser reduzido para 4, 2 ou 1. – Um index com 15 shards pode ser reduzido para 5, 3, ou 1.– Um index com 5 shards não pode ser reduzido para 3.
Elasticsearch 5.0Elasticsearch: Index Shrinking
0 1
2 3
0
1
SHRINK
2222
● Restrição 2: O operação de Shrink acontece fisicamente em apenas um nó do cluster. Sendo assim é preciso existir um nó no cluster com espaço suficiente para a operação.
Elasticsearch 5.0Elasticsearch: Index Shrinking
0 1
2 3
0
COPY
004
2323
● Dica: O processo de Shrink é significativamente mais rápido quando o filesystem suporta hard links.
Elasticsearch 5.0Elasticsearch: Index Shrinking
0
COPY
1 0
1
24
Muito Obrigado!DÚVIDAS?
Thiago Souzathiago@elastic.co
https://elastic.co/v5
https://elastic.co/docs
https://elastic.co/blog
https://discuss.elastic.co
https://meetup.com/Brasil-Elastic-Fantastics
Recommended