apache sling & friends tech meetup berlin, 22-24 … · elastic search – an introduction....

35
APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 SEPTEMBER 2014 Integrating ElasticSearch with AEM Vivek Sachdeva, Intelligrape Software

Upload: others

Post on 04-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

APACHE SLING & FRIENDS TECH MEETUPBERLIN, 22-24 SEPTEMBER 2014

Integrating ElasticSearch with AEMVivek Sachdeva, Intelligrape Software

Page 2: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Agenda

adaptTo() 2014 2

Introduction to ElasticSearch Analyzing Data Integration with AEM Approaches Considered Features Integrated Extension Points

Page 3: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

About Me :)

adaptTo() 2014 3

Started career as Java Developer in 2010 Worked on Groovy and Grails Currently working as AEM(plus Groovy) Developer Intelligrape Software [email protected] in.linkedin.com/pub/vivek-sachdeva/20/192/934/

Page 4: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 4

Elastic Search – An Introduction

Page 5: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

What & Why??

adaptTo() 2014 5

ElasticSearch is a distributed, RESTful, free/opensource search server

Based on Apache Lucene Developed by Shay Banon Latest Version – 1.2

Page 6: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

What & Why??

adaptTo() 2014 6

Document Oriented and Schema free Support for multi-tenancy Support for dynamic schema update High Performance Just like JCR

Page 7: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 7

ElasticSearch Server View

Page 8: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Index Creation

adaptTo() 2014 8

Page 9: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Fail Safe

adaptTo() 2014 9

Page 10: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 10

Analyzing Data

Page 11: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

How to Index??

adaptTo() 2014 11

First step is to identify the relevant data

Every novel is a mystery novel. Strangely I have not read any.

Page 12: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Bad Indexing

adaptTo() 2014 12

Every novel is a

mystery novel. Strangely I have not

read any.

Page 13: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Smart Indexing!!

adaptTo() 2014 13

Page 14: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 14

Integrating with AEM

Page 15: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

What All is Needed??

adaptTo() 2014 15

ElasticSearch Server CQ instance.. :)

Thats it...

Page 16: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

ElasticSearch dependency

adaptTo() 2014 16

Available in Maven repository

<dependency>

<groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId>

<version>1.2.0</version></dependency>

Page 17: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 17

Approaches Considered

Page 18: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Push & Pull Indexing

adaptTo() 2014 18

Push Indexing CQ Server pushes data to Elastic Server

whenever needed

Pull Indexing ElasticSearch Server pulls data at regular intervals

and indexes it

Page 19: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Push Indexing.. Using Replication Agent

adaptTo() 2014 19

Page 20: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Push Indexing... Using Replication Agent

adaptTo() 2014 20

Create Serialization Type and setup a replicationagent.

@Component(label = "Elastic Replication Content Builder", description = "This servlet replicates data to Elastic", immediate = true, enabled = true, metatype = true)

@Service(ContentBuilder.class)

class ElasticReplicationContentBuilderImpl implements ContentBuilder{//Override create method

}

Page 21: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Push Indexing... Using Replication Agent

adaptTo() 2014 21

Pros: Data can be pushed as and

when needed.

Page 22: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Pull Indexing

adaptTo() 2014 22

Page 23: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 23

Features Integrated

Page 24: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Features Integrated

adaptTo() 2014 24

Basic Aggregation Tag based faceting

Free Text Search Finding all pages in order of relevancy based on

some text

Page 25: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Facet

adaptTo() 2014 25

Page 26: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 26

DEMO

Page 27: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 27

More Cool Features/Extension Points...

Page 28: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Geo Facet

adaptTo() 2014 28

Lets say we need to

find all restaurants that are within 1

mile

Page 29: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Advanced Aggregation

adaptTo() 2014 29

aggregations: { group_by_state: { buckets: [ { key: wv doc_count: 1 average_age: { value: 22 } } { key: al doc_count: 2 average_age: { value: 22 } } ] …...............

Group all the employees

of an MNC by project location and find

average age of each group.

Page 30: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Percolator – Search.... Reversed.....

adaptTo() 2014 30

Tag all mails from Finance

as important

Page 31: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Ease of Clustering

adaptTo() 2014 31

Page 32: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 32

DEMO

Page 33: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

adaptTo() 2014 33

Appendix

Page 34: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Appendix

adaptTo() 2014 34

http://www.elasticsearch.com/ http://www.elasticsearch.org/guide/ https://forums.adobe.com Google :)

Page 35: APACHE SLING & FRIENDS TECH MEETUP BERLIN, 22-24 … · Elastic Search – An Introduction. What & Why?? adaptTo() 2014 5 ElasticSearch is a distributed, RESTful, free/open source

Where is the code??

adaptTo() 2014 35

● https://github.com/viveksachdeva

/elasticsearch-cq.git