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
0
170
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
Tweet
Share
More Decks by Markus H
See All by Markus H
🐍 ❤️ 🦀 — Python loves Rust
markush
0
220
Knock! Knock! Who's There?
markush
0
63
An Introduction To Kubernetes ☸
markush
0
88
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
13k
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon UK 2019)
markush
0
56
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon Australia 2019)
markush
1
200
Logging Rethought 2: The Actions of Frank Taylor Jr. (DjangoCon Europe 2019)
markush
0
13k
Other Decks in Programming
See All in Programming
Webからモバイルへ Vue.js × Capacitor 活用事例
naokihaba
0
760
Result型で“失敗”を型にするPHPコードの書き方
kajitack
4
290
Is Xcode slowly dying out in 2025?
uetyo
1
190
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
280
GitHub Copilot and GitHub Codespaces Hands-on
ymd65536
1
110
プロダクト志向ってなんなんだろうね
righttouch
PRO
0
150
Julia という言語について (FP in Julia « SIDE: F ») for 関数型まつり2025
antimon2
3
980
Deep Dive into ~/.claude/projects
hiragram
7
1.3k
Beyond Portability: Live Migration for Evolving WebAssembly Workloads
chikuwait
0
390
「Cursor/Devin全社導入の理想と現実」のその後
saitoryc
0
140
データの民主化を支える、透明性のあるデータ利活用への挑戦 2025-06-25 Database Engineering Meetup#7
y_ken
0
310
iOSアプリ開発で 関数型プログラミングを実現する The Composable Architectureの紹介
yimajo
2
210
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
69
11k
Code Review Best Practice
trishagee
68
18k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
Why You Should Never Use an ORM
jnunemaker
PRO
56
9.4k
Documentation Writing (for coders)
carmenintech
71
4.9k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Navigating Team Friction
lara
187
15k
A designer walks into a library…
pauljervisheath
206
24k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.8k
Statistics for Hackers
jakevdp
799
220k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.8k
Docker and Python
trallard
44
3.4k
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