ElasticaElasticaBundle            Nicolas Badey            CTO - Yoopies
ElasticSearch• Raised 10M$ in November 2012• First version in February 2010 after Compass was dropped• Competitors :     -...
ElasticSearch• “Distributed, RESTful, Search Engine built on top of Apache Lucene”• Schema-less• JSON• Java (Netty/Spatial...
Features•   Boost (scoring)•   Analyzers•   GeoLocation•   Facets•   Highlighting• Scripting : MVEL/Java/Javascript /Groov...
Why ElasticSearch ?• Very fast• Document != Data Model• Doctrine Mapping/Listener• Advanced search functionalities
Searchcurl -XGET http://localhost:9200/[INDEX]/[TYPE]/_search -d   ‘{     "query": {             "query_string": {        ...
Elastica• v0.19.8.0       => PHP 5.2• v0.20.5.0.RC1   => PHP 5.3 / PSR 0-1-2
ElasticaBundle• Persistence automatic provider, Doctrine/Propel/MongoDB• Pagination, PagerFanta / KNPpaginator• Service : ...
Mapping
Mapping
Filter vs Query• Filter  - cached  - speed• Query  - scoring
Cache• Filter (recommended)• Node• Index• Filter Cache is active by default for most of them• $filter->setCached(true);
ScriptFilter• Computed distance• Custom Scoring :  “_score * doc[my_numeric_field].value / pow(param1, param2)”
Highlight• Implement HighlightableModelInterface for model
Facets• Terms, Range, Histogram, Filter,  Query, Statistical, Terms Stats,  GeoDistance …
Data Transformer• ElasticaToModel Transformer• ModelToElastica Transformer
_search                            _percolator                              FormA                   FormB              Ent...
PercolatorRegisterMatch
Annexes• https://github.com/FriendsOfSymfony/FOSElasticaBundle• http://richardmiller.co.uk/• http://www.elasticsearch.org/...
Upcoming SlideShare
Loading in …5
×

ElasticSearch, Elastica, ElasticaBundle

8,563 views

Published on

Theses slides are outdated please read directly : http://fr.slideshare.net/nicolasbadey/elasticsearch-elastica-in-symfony2-sflive-2015

Published in: Technology

ElasticSearch, Elastica, ElasticaBundle

  1. 1. ElasticaElasticaBundle Nicolas Badey CTO - Yoopies
  2. 2. ElasticSearch• Raised 10M$ in November 2012• First version in February 2010 after Compass was dropped• Competitors : - Solr - Sphynx
  3. 3. ElasticSearch• “Distributed, RESTful, Search Engine built on top of Apache Lucene”• Schema-less• JSON• Java (Netty/Spatial4j)• Easy to install : dpkg –i elasticsearch.deb• Usage : Alternative Data Storage or/and Search Index
  4. 4. Features• Boost (scoring)• Analyzers• GeoLocation• Facets• Highlighting• Scripting : MVEL/Java/Javascript /Groovy/Python• Percolator (Prospective Search)• Cache• Plugin (attachment type, Twitter River …)
  5. 5. Why ElasticSearch ?• Very fast• Document != Data Model• Doctrine Mapping/Listener• Advanced search functionalities
  6. 6. Searchcurl -XGET http://localhost:9200/[INDEX]/[TYPE]/_search -d ‘{ "query": { "query_string": { "query": "foobar" } }, "filter": { "numeric_range": { "price": { "lte": 42 } } }, "sort": { "created_at": { "order": "desc" } }}’
  7. 7. Elastica• v0.19.8.0 => PHP 5.2• v0.20.5.0.RC1 => PHP 5.3 / PSR 0-1-2
  8. 8. ElasticaBundle• Persistence automatic provider, Doctrine/Propel/MongoDB• Pagination, PagerFanta / KNPpaginator• Service : Client Index Type Finder• Persistence listener CallBack (only Doctrine)• Custom Doctrine query builder• Custom Provider• Custom Elastica To Model Transformer/Model To Elastica Transformer• Exercise / FOQElasticaBundle => FriendsOfSymfony/FOSElasticaBundle
  9. 9. Mapping
  10. 10. Mapping
  11. 11. Filter vs Query• Filter - cached - speed• Query - scoring
  12. 12. Cache• Filter (recommended)• Node• Index• Filter Cache is active by default for most of them• $filter->setCached(true);
  13. 13. ScriptFilter• Computed distance• Custom Scoring : “_score * doc[my_numeric_field].value / pow(param1, param2)”
  14. 14. Highlight• Implement HighlightableModelInterface for model
  15. 15. Facets• Terms, Range, Histogram, Filter, Query, Statistical, Terms Stats, GeoDistance …
  16. 16. Data Transformer• ElasticaToModel Transformer• ModelToElastica Transformer
  17. 17. _search _percolator FormA FormB Entity Search Search ModelA ModelB Model ToElastica ElasticaQuery Factory Document Percolator Query Percolator Elastica Finder TypeToModel Array (match) Response Entities Set
  18. 18. PercolatorRegisterMatch
  19. 19. Annexes• https://github.com/FriendsOfSymfony/FOSElasticaBundle• http://richardmiller.co.uk/• http://www.elasticsearch.org/• https://github.com/sonian/elasticsearch-jetty• http://www.elasticsearch.org/tutorials/javascript-web-applications-and- elasticsearch/• http://www.elasticsearch.org/tutorials/using-elasticsearch-for-logs/• http://blog.sematext.com/2012/08/23/solr-vs-elasticsearch-part-1- overview/

×