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
210
Knock! Knock! Who's There?
markush
0
63
An Introduction To Kubernetes ☸
markush
0
83
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
55
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon Australia 2019)
markush
1
190
Logging Rethought 2: The Actions of Frank Taylor Jr. (DjangoCon Europe 2019)
markush
0
13k
Other Decks in Programming
See All in Programming
私のRubyKaigi 2025 Kaigi Effect / My RubyKaigi 2025 Kaigi Effect
chobishiba
1
170
バイラテラルアップサンプリング
fadis
3
630
監視 やばい
syossan27
12
10k
In geheimer Mission: AI Agents entwickeln
joergneumann
0
130
生成AI時代のフルスタック開発
kenn
8
1k
オープンソースコントリビュート入門
_katsuma
0
150
generative-ai-use-cases(GenU)の推しポイント ~2025年4月版~
hideg
1
430
ビカム・ア・コパイロット
ymd65536
1
160
エンジニアが挑む、限界までの越境
nealle
1
350
Global Azure 2025 @ Kansai / Hyperlight
kosmosebi
0
160
最速Green Tea 🍵 Garbage Collector
kuro_kurorrr
1
160
LRパーサーはいいぞ
ydah
7
1.5k
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.5k
Art, The Web, and Tiny UX
lynnandtonic
298
21k
Making the Leap to Tech Lead
cromwellryan
133
9.3k
Typedesign – Prime Four
hannesfritz
41
2.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Docker and Python
trallard
44
3.4k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
How GitHub (no longer) Works
holman
314
140k
Raft: Consensus for Rubyists
vanstee
137
6.9k
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