elasticsearch 5.0

24
1 Thiago Souza Support Engineer @ Elastic Elasticsearch 5.0

Upload: thiago-souza

Post on 09-Feb-2017

149 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Elasticsearch 5.0

1

Thiago SouzaSupport Engineer @ Elastic

Elasticsearch 5.0

Page 2: 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

Page 3: Elasticsearch 5.0

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

Page 4: Elasticsearch 5.0

44

Global Customer Base

Tech

Finance

Telco

Consumer

Page 5: Elasticsearch 5.0

5

Elasticsearch is an Open Source (Apache 2),

Distributed, RESTful, Search Engine built on top of Lucene.

http://www.elasticsearch.org - 2011

Page 6: Elasticsearch 5.0

6

Apache LuceneTM is a high-performance, full-featured text

search engine library written entirely in Java.

https://lucene.apache.org/core

Page 7: Elasticsearch 5.0

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

Page 8: Elasticsearch 5.0

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"

Page 9: Elasticsearch 5.0

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

Page 10: Elasticsearch 5.0

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

Page 11: Elasticsearch 5.0

11

Elasticsearch 5.0Elasticsearch: v0.90.0 (2013)

• Alta Disponibilidade

• Escalabilidade Horizontal

• API RESTful

• Busca Full Text

• Busca Multifaceted:‒Term‒Histogram‒Range‒etc...

Page 12: Elasticsearch 5.0

12

Page 13: Elasticsearch 5.0

13

Elasticsearch 5.0Elastic Stack 5.0

• Nova identidade visual

• Release unificado

• X-Pack: Pacote de Plugins

Page 14: Elasticsearch 5.0

14

Page 15: Elasticsearch 5.0

1515

Segurança

Elasticsearch 5.0Elasticsearch

● Java Security Manager para plugins.● Sandboxed Scripting (Painless).● Verificação de Jarhell.● Suporte a Site plugins removido.

Page 16: Elasticsearch 5.0

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

Page 17: Elasticsearch 5.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

Page 18: Elasticsearch 5.0

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

Page 19: Elasticsearch 5.0

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"}

Page 20: Elasticsearch 5.0

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" }}

Page 21: Elasticsearch 5.0

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

Page 22: Elasticsearch 5.0

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

Page 23: Elasticsearch 5.0

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

Page 24: Elasticsearch 5.0

24

Muito Obrigado!DÚVIDAS?

Thiago [email protected]

https://elastic.co/v5

https://elastic.co/docs

https://elastic.co/blog

https://discuss.elastic.co

https://meetup.com/Brasil-Elastic-Fantastics