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
80
Keep It Simple Security (Symfony Cafe 28-01-2016)
cystbear
0
120
Erlang (GeekTalks)
cystbear
0
74
Clojure basics
cystbear
0
82
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
910
MongoDB KNPLabs GeekTime
cystbear
1
79
Other Decks in Technology
See All in Technology
20241228 - 成為最強魔法使!AI 實時生成比賽的策略 @ 2024 SD AI 年會
dpys
0
340
NOT VALIDな検査制約 / check constraint that is not valid
yahonda
1
110
I could be Wrong!! - Learning from Agile Experts
kawaguti
PRO
8
2.6k
Unsafe.BitCast のすゝめ。
nenonaninu
0
160
信頼されるためにやったこと、 やらなかったこと。/What we did to be trusted, What we did not do.
bitkey
PRO
0
1.7k
rootful・rootless・privilegedコンテナの違い/rootful_rootless_privileged_container_difference
moz_sec_
0
110
2025年のARグラスの潮流
kotauchisunsun
0
140
動画配信の フロントエンドを支える 4年間とこれから
nisshii0313
0
110
あなたの⼈⽣も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
0
180
AWS re:Invent 2024 ふりかえり勉強会
yhana
0
700
怖くない!ゼロから始めるPHPソースコードコンパイル入門
colopl
0
240
AI×医用画像の現状と可能性_2024年版/AI×medical_imaging_in_japan_2024
tdys13
0
1.2k
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Visualization
eitanlees
146
15k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Optimizing for Happiness
mojombo
376
70k
Optimising Largest Contentful Paint
csswizardry
33
3k
Become a Pro
speakerdeck
PRO
26
5.1k
Building Your Own Lightsaber
phodgson
104
6.2k
Thoughts on Productivity
jonyablonski
68
4.4k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Into the Great Unknown - MozCon
thekraken
34
1.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
340
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