Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Haystack + ElasticSearch
Search
Gilang Chandrasa
June 29, 2013
Programming
2
2.4k
Haystack + ElasticSearch
Gilang Chandrasa
June 29, 2013
Tweet
Share
More Decks by Gilang Chandrasa
See All by Gilang Chandrasa
Docker + Django
gchandrasa
2
330
An Introduction to Celery
gchandrasa
8
5.1k
Other Decks in Programming
See All in Programming
AWS CDKの推しポイントN選
akihisaikeda
1
240
Developing static sites with Ruby
okuramasafumi
0
300
Microservices rules: What good looks like
cer
PRO
0
1.5k
AIコーディングエージェント(NotebookLM)
kondai24
0
200
JETLS.jl ─ A New Language Server for Julia
abap34
1
410
AIコーディングエージェント(Gemini)
kondai24
0
230
関数実行の裏側では何が起きているのか?
minop1205
1
700
Why Kotlin? 電子カルテを Kotlin で開発する理由 / Why Kotlin? at Henry
agatan
2
7.3k
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
200
開発に寄りそう自動テストの実現
goyoki
2
1k
認証・認可の基本を学ぼう前編
kouyuume
0
250
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
120
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1032
470k
How to Ace a Technical Interview
jacobian
281
24k
Designing for Performance
lara
610
69k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Docker and Python
trallard
47
3.7k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Building an army of robots
kneath
306
46k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Rails Girls Zürich Keynote
gr2m
95
14k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Transcript
Haystack + ElasticSearch Gilang Chandrasa
Django Python PHP ElasticSearch HTML5 Memcache MongoDB Celery NginX Android
Git MySQL PostgreSQL Gilang Chandrasa CSS3
Haystack Why What How
A modular search for Django
lets you write your search code once and choose the
search engine you want it to run on
lets you write your search code once and choose the
search engine you want it to run on Solr, Elasticsearch, Whoosh and Xapian
pip install django-haystack Step 1 Install Haystack
INSTALLED_APPS = [ ... 'haystack', ] HAYSTACK_CONNECTIONS = { 'default':
{ 'ENGINE': '...', }, } Step 2 Configure settings.py
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
{{ object.title }} {{ object.user.get_full_name }} {{ object.body }} Step
4 Create search template
Step 5 Install Search Engine Solr Xapian Whoosh ElasticSearch
Step 6 Indexing python manage.py rebuild_index
Some Advanced Uses Highlighting Autocomplete Boost Rich Content Extraction Spatial
Search
ElasticSearch
ElasticSearch distributed real-time search and analytics engine for the cloud
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
Spatial Search within, dwithin, distance, order_by(‘distance’), polygon
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
haystacksearch.org elasticsearch.org Further Reading
thank you!
Gilang Chandrasa twitter.com + github.com @gchandrasa