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 Symfony2 integration, data struct...
Search
Oleg Zinchenko
May 31, 2013
Technology
1
250
Elasticsearch Symfony2 integration, data structures
Oleg Zinchenko
May 31, 2013
Tweet
Share
More Decks by Oleg Zinchenko
See All by Oleg Zinchenko
ORO Meetup #4
cystbear
0
83
Keep It Simple Security (Symfony Cafe 28-01-2016)
cystbear
0
130
Erlang (GeekTalks)
cystbear
0
77
Clojure basics
cystbear
0
85
Welcome to Erlang
cystbear
0
91
Erlang/N2O KNPMeetup
cystbear
0
160
Symfony Best Practices and beyond
cystbear
1
230
DDD on example of Symfony (SymfonyCamp UA 2014)
cystbear
3
920
MongoDB KNPLabs GeekTime
cystbear
1
83
Other Decks in Technology
See All in Technology
~宇宙最速~2025年AWS Summit レポート
satodesu
1
1.3k
Prox Industries株式会社 会社紹介資料
proxindustries
0
200
_第3回__AIxIoTビジネス共創ラボ紹介資料_20250617.pdf
iotcomjpadmin
0
140
成立するElixirの再束縛(再代入)可という選択
kubell_hr
0
920
Claude Code Actionを使ったコード品質改善の取り組み
potix2
PRO
4
1.6k
(非公式) AWS Summit Japan と 海浜幕張 の歩き方 2025年版
coosuke
PRO
1
330
ユーザーのプロフィールデータを活用した推薦精度向上の取り組み
yudai00
0
490
変化する開発、進化する体系時代に適応するソフトウェアエンジニアの知識と考え方(JaSST'25 Kansai)
mizunori
0
140
白金鉱業Meetup_Vol.19_PoCはデモで語れ!顧客の本音とインサイトを引き出すソリューション構築
brainpadpr
2
490
標準技術と独自システムで作る「つらくない」SaaS アカウント管理 / Effortless SaaS Account Management with Standard Technologies & Custom Systems
yuyatakeyama
2
1k
rubygem開発で鍛える設計力
joker1007
1
120
Workflows から Agents へ ~ 生成 AI アプリの成長過程とアプローチ~
belongadmin
3
170
Featured
See All Featured
Embracing the Ebb and Flow
colly
86
4.7k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
4
200
The Cult of Friendly URLs
andyhume
79
6.4k
Why Our Code Smells
bkeepers
PRO
337
57k
How to train your dragon (web standard)
notwaldorf
92
6.1k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
16
940
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
790
How to Ace a Technical Interview
jacobian
277
23k
The Language of Interfaces
destraynor
158
25k
Transcript
None
Symfony developer sinсe 2009 TeamLead at Exercise.com Symfony2 evangelist https://twitter.com/1cdecoder
https://github.com/cystbear http://cystbear.tumblr.com/
elasticsearch
None
SELECT * FROM Article WHERE Text LIKE 'Symfony';
None
Shay Banon 07-Jul-2010 http://www.kimchy.org/the_future_of_compass/
None
None
* List * Graph * Tree * Hash * Heap
* Queue * Stack
Tree
Binary search tree
AVL-tree
B-tree
ANOTHER WAY
Indexes B-Tree Spatial grid Quadtree R-Tree Hash Bitmap Reverse index
Inverted index Partial index Function-based index http://habrahabr.ru/post/102785/
Inverted index "it is what it is" -- 0 "what
is it" -- 1 "it is a banana" -- 2
Inverted index "it is what it is" -- 0 "what
is it" -- 1 "it is a banana" -- 2 "a": {2} "banana": {2} "is": {0, 1, 2} "it": {0, 1, 2} "what": {0, 1}
Inverted index "it is what it is" -- 0 "what
is it" -- 1 "it is a banana" -- 2 "a": {2} "banana": {2} "is": {0, 1, 2} "it": {0, 1, 2} "what": {0, 1} "what is it"
Inverted index "it is what it is" -- 0 "what
is it" -- 1 "it is a banana" -- 2 "a": {2} "banana": {2} "is": {0, 1, 2} "it": {0, 1, 2} "what": {0, 1} "what is it" "what" "is" "it"
Inverted index "it is what it is" -- 0 "what
is it" -- 1 "it is a banana" -- 2 "a": {2} "banana": {2} "is": {0, 1, 2} "it": {0, 1, 2} "what": {0, 1} "what is it" "what" "is" "it"
Inverted index "it is what it is" -- 0 "what
is it" -- 1 "it is a banana" -- 2 "a": {2} "banana": {2} "is": {0, 1, 2} "it": {0, 1, 2} "what": {0, 1} "what is it" "what" "is" "it" {0,1} ⋂ {0,1,2} ⋂ {0,1,2} = {0,1}
Inverted index "it is what it is" -- 0 "what
is it" -- 1 "it is a banana" -- 2 "a": {2} "banana": {2} "is": {0, 1, 2} "it": {0, 1, 2} "what": {0, 1} "what is it" "what" "is" "it" {0,1} ⋂ {0,1,2} ⋂ {0,1,2} = {0,1} "it is what it is", "what is it"
Morphology Stop words
elasticsearch Real time data Real time analytics Distributed High availability
Multi-tenancy Full text search JSON Document oriented Conflict management Schema free RESTful API Build on top of Apache Lucene
elasticsearch base Index Type Document
elasticsearch types String Number Date Boolean Binary
elasticsearch CRUD curl -XPUT http://localhost:9200/blog/article/1 -d '{ "title": "New version
of Elastic Search released!", "content": "...", "tags": ["announce", "elasticsearch", "release"] }'
http://www.amazon.com/ElasticSearch-Server-ebook/dp/B00BAOC2KQ
PHP/Symfony2 integration Java Lucene Elasticsearch PHP Elastica FOSElasticaBundle
FOSElasticaBundle External serializer (JMSserializer) Persistence: orm, mongodb, propel Native repositories
Custom query builder: repo method Pagination: Pagerfanta, KnpPaginator
FOSElasticaBundle External serializer (JMSserializer) fos_elastica: clients: default: { host: localhost,
port: 9200 } serializer: callback_class: FOS\ElasticaBundle\Serializer\Callback serializer: serializer indexes: website: client: default types: user: mappings: username: { boost: 5 } firstName: { boost: 3 } lastName: { boost: 3 } aboutMe: ~
FOSElasticaBundle Persistence: orm, mongodb, propel fos_elastica: clients: default: { host:
localhost, port: 9200 } serializer: callback_class: FOS\ElasticaBundle\Serializer\Callback serializer: serializer indexes: website: client: default types: user: mappings: username: { boost: 5 } firstName: { boost: 3 } # more mappings... persistence: driver: mongodb model: Application\UserBundle\Document\User provider: ~
FOSElasticaBundle Custom query builder: repo method persistence: driver: mongod model:
Application\UserBundle\Document\User provider: query_builder_method: createIsActiveQueryBuilder
FOSElasticaBundle Pagination: Pagerfanta, KnpPaginator $finder = $container->get('fos_elastica.finder.website.user'); /* Pagerfanta */
$userPaginator = $finder->findPaginated('bob'); /* Knp paginator */ $paginator = $this->get('knp_paginator'); $userPaginator = $paginator ->paginate($finder->createPaginatorAdapter('bob'));
FOSElasticaBundle Search $finder = $this->container->get('fos_elastica.finder.website.article'); $boolQuery = new \Elastica\Query\Bool(); $fieldQuery
= new \Elastica\Query\Text(); $fieldQuery->setFieldQuery('title', 'I am a title string'); $fieldQuery->setFieldParam('title', 'analyzer', 'my_analyzer'); $boolQuery->addShould($fieldQuery); $tagsQuery = new \Elastica\Query\Terms(); $tagsQuery->setTerms('tags', array('tag1', 'tag2')); $boolQuery->addShould($tagsQuery); $categoryQuery = new \Elastica\Query\Terms(); $categoryQuery->setTerms('categoryIds', array('1', '2', '3')); $boolQuery->addMust($categoryQuery); $data = $finder->find($boolQuery);
None