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
240
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
78
Keep It Simple Security (Symfony Cafe 28-01-2016)
cystbear
0
120
Erlang (GeekTalks)
cystbear
0
73
Clojure basics
cystbear
0
82
Welcome to Erlang
cystbear
0
81
Erlang/N2O KNPMeetup
cystbear
0
160
Symfony Best Practices and beyond
cystbear
1
220
DDD on example of Symfony (SymfonyCamp UA 2014)
cystbear
3
910
MongoDB KNPLabs GeekTime
cystbear
1
78
Other Decks in Technology
See All in Technology
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
390
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
210
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
2
3.2k
強いチームと開発生産性
onk
PRO
36
12k
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
13k
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
3
640
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
950
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
130
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
7
690
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
710
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Six Lessons from altMBA
skipperchong
27
3.5k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
RailsConf 2023
tenderlove
29
900
What's new in Ruby 2.0
geeforr
343
31k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
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