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
ElasticSearch
Search
nyumatova
August 24, 2012
Programming
230
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ElasticSearch
nyumatova
August 24, 2012
More Decks by nyumatova
See All by nyumatova
Commit messages
nyumatova
5
3.2k
Other Decks in Programming
See All in Programming
These Five Tricks Can Make Your Apps Greener, Cheaper, & Nicer
hollycummins
0
280
「AIで開発し、AIを届ける」をEvalでつなぐ 〜AIネイティブに始めるプロダクト開発の実践〜 / Connecting "Develop with AI, deliver AI" with Eval
rkaga
4
4.9k
スマートグラスで並列バイブコーディング
hyshu
0
120
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
490
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.3k
CSC307 Lecture 17
javiergs
PRO
0
320
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
320
dRuby over BLE
makicamel
2
330
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
210
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
120
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
RTSPクライアントを自作してみた話
simotin13
0
520
Featured
See All Featured
Context Engineering - Making Every Token Count
addyosmani
9
960
Building an army of robots
kneath
306
46k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
The Pragmatic Product Professional
lauravandoore
37
7.3k
A Modern Web Designer's Workflow
chriscoyier
698
190k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Between Models and Reality
mayunak
4
330
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Evolving SEO for Evolving Search Engines
ryanjones
0
210
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
Transcript
Полнотекстовый поиск Полнотекстовый поиск
Зачем? Зачем? Ответ прост - производительность
Какой выбор? Какой выбор? Elastic Search Solr Xapian Sphinx
Почему ElasticSearch? Почему ElasticSearch? Хорошая поддержка русского языка Прост в
установке и настройке Удобная работа с индексами Приятный Query DSL (domain-specific language) pyes и elasticutils (от mozilla) Индексация в режиме реального времени
elasticutils (pyes): индексы elasticutils (pyes): индексы from elasticutils import get_es
connector = get_es(hosts=['127.0.0.1:9200']) connector.delete_index_if_exists('crm') connector.create_index('crm', settings=SETTINGS) connector.put_mapping('clients', { 'properties': CLIENTS_MAPPING, '_type': {'store': 'yes'} }, ['crm']) connector.put_mapping('contacts', { 'properties': CONTACTS_MAPPING, '_type': {'store': 'yes'} }, ['crm'])
ElasticSearch REST API curl ElasticSearch REST API curl $ curl
-‐XGET 'http://localhost:9200/crm/_search' -‐d '{ 'filter': { 'and': [{'term': {'_type': u'clients'}}, {'term': {'is_client': True}}] }, 'query': { 'query_string': {'query': u'петров', 'default_field': 'content'} }, 'sort': [{u'modified_on': 'desc'}], 'from': 15, 'size': 5, 'fields': ['id'] }'
elasticutils elasticutils Удобный Django-QuerySet-like API для работы с ElasticSearch
elasticutils: базовый класс elasticutils: базовый класс from elasticutils import S
searcher = S().indexes('crm')
elasticutils: query elasticutils: query ... query = u'иванов' searcher =
searcher.query( content__query_string=query )
elasticutils: filter elasticutils: filter ... kwargs = {'is_client': True} searcher
= searcher.filter(**kwargs)
elasticutils: order_by elasticutils: order_by ... order_by = '-‐title' searcher =
searcher.order_by(order_by)
спасибо спасибо