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
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
36
🐍 ❤️ 🦀 — Python loves Rust
markush
0
300
Knock! Knock! Who's There?
markush
0
100
An Introduction To Kubernetes ☸
markush
0
150
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
83
Logging Rethought 2: The Actions of Frank Taylor Jr. (PyCon Australia 2019)
markush
1
240
Other Decks in Programming
See All in Programming
ITヒヤリハットを整理してみた ~ライフサイクルと原因から考える再発防止策~
koukimiura
1
140
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
860
数百円から始めるRuby電子工作
tarosay
0
150
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
260
VibeCodingからAgenticWorkflowへ
starfish719
0
460
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
500
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
4
1.6k
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
470
源内ハンズオン概要編
hideg
0
180
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
210
リアルな遅延を測る仕様
kota_yata
1
100
今さら聞けない .NET CLI
htkym
0
190
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
170
How to train your dragon (web standard)
notwaldorf
97
6.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Deep Space Network (abreviated)
tonyrice
0
260
VelocityConf: Rendering Performance Case Studies
addyosmani
332
25k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
170
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
490
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
Optimizing for Happiness
mojombo
378
71k
First, design no harm
axbom
PRO
2
1.2k
sira's awesome portfolio website redesign presentation
elsirapls
0
320
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