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 structures
Search
Oleg Zinchenko
May 31, 2013
Technology
1
230
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
77
Keep It Simple Security (Symfony Cafe 28-01-2016)
cystbear
0
110
Erlang (GeekTalks)
cystbear
0
69
Clojure basics
cystbear
0
79
Welcome to Erlang
cystbear
0
81
Erlang/N2O KNPMeetup
cystbear
0
140
Symfony Best Practices and beyond
cystbear
1
200
DDD on example of Symfony (SymfonyCamp UA 2014)
cystbear
3
910
MongoDB KNPLabs GeekTime
cystbear
1
66
Other Decks in Technology
See All in Technology
Improve Your Development Workflow with Gemini Code Assist
meteatamel
0
120
GrafanaMeetup_AmazonManagedGrafanaのアクセス制御機能とマルチテナント環境下でのアクセス制御について
daitak
0
380
【基本】データベース設計
oracle4engineer
PRO
2
120
Cypress or Playwright?
rainerhahnekamp
0
160
AWS学習者向けにAzureの解説スライドを作成した話
handy
3
180
MLOpsの「壁」を乗り越える、LINEヤフーの Data Quality as Code
lycorptech_jp
PRO
8
610
「スニダン」開発組織の構造に込めた意図 ~組織作りはパッションや政治ではない!~
rinchsan
4
610
よく聞くけど使ったことないソフトウェアNo.1 KafkaとSnowflake
foursue
4
490
Amplify 🩷 Bedrock 〜生成AI入門〜
minorun365
PRO
7
380
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
150
TechFeed Experts Night#27 〜 フロントエンドフレームワーク最前線 (Svelte)
baseballyama
2
590
Building Dashboards as a Hobby
egmc
0
350
Featured
See All Featured
How to name files
jennybc
65
93k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.6k
Designing Experiences People Love
moore
136
23k
10 Git Anti Patterns You Should be Aware of
lemiorhan
649
58k
The Mythical Team-Month
searls
216
42k
Done Done
chrislema
178
15k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
358
22k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
13
8.3k
Building Effective Engineering Teams - LeadDev
addyosmani
31
1.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
18
1.6k
Visualization
eitanlees
137
14k
The Pragmatic Product Professional
lauravandoore
26
5.8k
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