Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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.3k
Haystack + ElasticSearch
Gilang Chandrasa
June 29, 2013
Tweet
Share
More Decks by Gilang Chandrasa
See All by Gilang Chandrasa
Docker + Django
gchandrasa
2
320
An Introduction to Celery
gchandrasa
8
5.1k
Other Decks in Programming
See All in Programming
Rubyと自由とAIと
yotii23
6
1.8k
color-scheme: light dark; を完全に理解する
uhyo
7
490
Ça bouge du côté des animations CSS !
goetter
2
150
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
41
16k
Djangoにおける複数ユーザー種別認証の設計アプローチ@DjangoCongress JP 2025
delhi09
PRO
4
470
はじめての Go * WASM *OCR
sgash708
1
100
Honoのおもしろいミドルウェアをみてみよう
yusukebe
1
230
15分で学ぶDuckDBの可愛い使い方 DuckDBの最近の更新
notrogue
3
520
お前もAI鬼にならないか?👹Bolt & Cursor & Supabase & Vercelで人間をやめるぞ、ジョジョー!👺
taishiyade
7
4.2k
クリーンアーキテクチャから見る依存の向きの大切さ
shimabox
5
1.1k
もう僕は OpenAPI を書きたくない
sgash708
6
1.9k
Unity Android XR入門
sakutama_11
0
180
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.3k
The Cult of Friendly URLs
andyhume
78
6.2k
Side Projects
sachag
452
42k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.3k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
7k
BBQ
matthewcrist
87
9.5k
Building Your Own Lightsaber
phodgson
104
6.2k
Documentation Writing (for coders)
carmenintech
67
4.6k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
175
52k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
133
33k
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