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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Markus H
February 12, 2015
Programming
0
180
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
260
Knock! Knock! Who's There?
markush
0
72
An Introduction To Kubernetes ☸
markush
0
110
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
67
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon Australia 2019)
markush
1
220
Logging Rethought 2: The Actions of Frank Taylor Jr. (DjangoCon Europe 2019)
markush
0
13k
Other Decks in Programming
See All in Programming
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
140
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.2k
CSC307 Lecture 01
javiergs
PRO
0
690
Oxlint JS plugins
kazupon
1
960
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
610
CSC307 Lecture 05
javiergs
PRO
0
500
CSC307 Lecture 03
javiergs
PRO
1
490
ぼくの開発環境2026
yuzneri
0
230
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
130
今から始めるClaude Code超入門
448jp
8
8.8k
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.4k
CSC307 Lecture 04
javiergs
PRO
0
660
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
Are puppies a ranking factor?
jonoalderson
1
2.7k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
780
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
430
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
270
A Tale of Four Properties
chriscoyier
162
24k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.1k
Producing Creativity
orderedlist
PRO
348
40k
The Curious Case for Waylosing
cassininazir
0
240
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
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