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
Integrating Sphinx and Elasticsearch
Search
Markus H
February 12, 2015
Programming
180
0
Share
Integrating Sphinx and Elasticsearch
This is a lightning talk presentation I gave a the Python Users Berlin meetup on Feb 12, 2015
Markus H
February 12, 2015
More Decks by Markus H
See All by Markus H
Oh, I Found a Security Issue (reloaded 2026)
markush
0
23
🐍 ❤️ 🦀 — Python loves Rust
markush
0
280
Knock! Knock! Who's There?
markush
0
91
An Introduction To Kubernetes ☸
markush
0
130
Writing Safe Database Migrations (DjangoCon Europe 2021)
markush
0
14k
A Pony On The Move: How Migrations Work In Django 🐎
markush
0
13k
All Hands on Deck — Handling Security Issues
markush
0
14k
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon UK 2019)
markush
0
76
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon Australia 2019)
markush
1
230
Other Decks in Programming
See All in Programming
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
0
130
PHPer、Cloudflare に引っ越す
suguruooki
2
230
ECR拡張スキャンでSBOMを収集して サプライチェーン攻撃の影響調査を 爆速で終わらせてみた
akihisaikeda
1
130
GitHubCopilotCLIをはじめよう.pdf
htkym
0
340
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
220
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
160
Stage 3 Decorators でできること / できないこと / TSKaigi 2026
susisu
0
120
【ディップ|26年新卒研修資料】OpenAPI/Swagger REST API研修
dip_tech
PRO
0
170
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.7k
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
160
Back to the roots of date
jinroq
0
880
【ディップ|26年新卒研修資料】TDD実装演習
dip_tech
PRO
0
190
Featured
See All Featured
Music & Morning Musume
bryan
47
7.2k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Embracing the Ebb and Flow
colly
88
5k
A Tale of Four Properties
chriscoyier
163
24k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Scaling GitHub
holman
464
140k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
230
Into the Great Unknown - MozCon
thekraken
41
2.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
Ethics towards AI in product and experience design
skipperchong
2
270
Transcript
Sphinx and Elasticsearch
• elasticsearch-dsl==0.0.3 • Sphinx==1.2.3 Which libraries to use?
def setup(app): app.connect( 'doctree-resolved', index ) Sphinx integration
from elasticsearch_dsl import DocType, String class Document(DocType): title = String(analyzer='snowball',
boost=5) body = String(analyzer='snowball') docname = String(index='not_analyzed') class Meta: index = 'docs' Elasticsearch Document
import hashlib from elasticsearch_dsl.connections import connections connections.create_connection(hosts=['localhost']) def index(app, doctree,
docname): title = app.env.titles[docname].astext() doc = Document( title=title, body=doctree.astext(), docname=docname, ) doc.id = hashlib.md5(docname.encode('utf-8')).hexdigest() doc.save() Index a Document
from elasticsearch_dsl.connections import connections connections.create_connection(hosts=['localhost']) search = Document.search() query =
search.query( 'query_string', query='Migrations', fields=['title', 'body'], ).highlight_options(order='score').highlight('body') results = query.execute() Search
>>> for hit in results: ... print(hit.title) Writing database migrations
Writing your first Django app, part 1 Django documentation FAQ: Databases and models System check framework ... Using the hits
Thank you! markusholtermann.eu @m_holtermann github.com/MarkusH