Slide 1

Slide 1 text

Haystack + ElasticSearch Gilang Chandrasa

Slide 2

Slide 2 text

Django Python PHP ElasticSearch HTML5 Memcache MongoDB Celery NginX Android Git MySQL PostgreSQL Gilang Chandrasa CSS3

Slide 3

Slide 3 text

Haystack Why What How

Slide 4

Slide 4 text

A modular search for Django

Slide 5

Slide 5 text

lets you write your search code once and choose the search engine you want it to run on

Slide 6

Slide 6 text

lets you write your search code once and choose the search engine you want it to run on Solr, Elasticsearch, Whoosh and Xapian

Slide 7

Slide 7 text

pip install django-haystack Step 1 Install Haystack

Slide 8

Slide 8 text

INSTALLED_APPS = [ ... 'haystack', ] HAYSTACK_CONNECTIONS = { 'default': { 'ENGINE': '...', }, } Step 2 Configure settings.py

Slide 9

Slide 9 text

class NoteIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) author = indexes.CharField(model_attr='user') def get_model(self): return Note Step 3 Create search_index.py

Slide 10

Slide 10 text

{{ object.title }} {{ object.user.get_full_name }} {{ object.body }} Step 4 Create search template

Slide 11

Slide 11 text

Step 5 Install Search Engine Solr Xapian Whoosh ElasticSearch

Slide 12

Slide 12 text

Step 6 Indexing python manage.py rebuild_index

Slide 13

Slide 13 text

Some Advanced Uses Highlighting Autocomplete Boost Rich Content Extraction Spatial Search

Slide 14

Slide 14 text

ElasticSearch

Slide 15

Slide 15 text

ElasticSearch distributed real-time search and analytics engine for the cloud

Slide 16

Slide 16 text

real time data real time analytics distributed high availability multi tenancy full text search document oriented conflict management schema free restful API apache 2 open source license per operation persistence built on top apache lucene

Slide 17

Slide 17 text

Spatial Search within, dwithin, distance, order_by(‘distance’), polygon

Slide 18

Slide 18 text

location = Point(float(longitude), float(latitude)) SearchQuerySet()\ .dwithin('location', location,D(km=10))\ .distance('location',location)\ .order_by('distance') Search places within 10km and order by distance

Slide 19

Slide 19 text

haystacksearch.org elasticsearch.org Further Reading

Slide 20

Slide 20 text

thank you!

Slide 21

Slide 21 text

Gilang Chandrasa twitter.com + github.com @gchandrasa