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
80
Keep It Simple Security (Symfony Cafe 28-01-2016)
cystbear
0
120
Erlang (GeekTalks)
cystbear
0
74
Clojure basics
cystbear
0
83
Welcome to Erlang
cystbear
0
83
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
79
Other Decks in Technology
See All in Technology
7日間でハッキングをはじめる本をはじめてみませんか?_ITエンジニア本大賞2025
nomizone
2
1.9k
(機械学習システムでも) SLO から始める信頼性構築 - ゆる SRE#9 2025/02/21
daigo0927
0
150
地方拠点で エンジニアリングマネージャーってできるの? 〜地方という制約を楽しむオーナーシップとコミュニティ作り〜
1coin
1
230
SA Night #2 FinatextのSA思想/SA Night #2 Finatext session
satoshiimai
1
140
デスクトップだけじゃないUbuntu
mtyshibata
0
160
Oracle Cloud Infrastructure:2025年2月度サービス・アップデート
oracle4engineer
PRO
1
220
人はなぜISUCONに夢中になるのか
kakehashi
PRO
6
1.7k
2025-02-21 ゆるSRE勉強会 Enhancing SRE Using AI
yoshiiryo1
1
370
2.5Dモデルのすべて
yu4u
2
880
プロセス改善による品質向上事例
tomasagi
2
2.6k
Classmethod AI Talks(CATs) #17 司会進行スライド(2025.02.19) / classmethod-ai-talks-aka-cats_moderator-slides_vol17_2025-02-19
shinyaa31
0
120
Cloud Spanner 導入で実現した快適な開発と運用について
colopl
1
720
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
133
9.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.2k
Building Applications with DynamoDB
mza
93
6.2k
Fireside Chat
paigeccino
34
3.2k
Testing 201, or: Great Expectations
jmmastey
42
7.2k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
Unsuck your backbone
ammeep
669
57k
GitHub's CSS Performance
jonrohan
1030
460k
Being A Developer After 40
akosma
89
590k
The World Runs on Bad Software
bkeepers
PRO
67
11k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Invisible Side of Design
smashingmag
299
50k
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