Elasticsearch to najpopularniejsza wyszukiwarka pełnotekstowa o potężnych możliwościach. Jako programista PHP z kilkunastoletnim stażem, a obecnie pracownik Elastic (twórców Elasticsearch) chciałbym się z Wami podzielić najlepszym z obu światów.
+
View Slide
$ whoamiSebastian Grodzicki • Senior Engineering Manager at• ex-CTO at GoldenLine & SHOWROOM• SensioLabs Certified Symfony Developer@sebgrodzicki
Elastic Stack
Vanilla PHP
Official low-level client for Elasticsearch• Official PHP client for Elasticsearch: elastic/elasticsearch-php• Updated and released with the Elastic Stack version• Uses connection pool for cluster configuration• Exposes the Elasticsearch APIs using functions of a Client class• Each function returns the body of a HTTP response fromElasticsearch or a boolean value for HEAD API (e.g., Index existsAPI)
Official low-level client for Elasticsearch
..Semantic Versioning7 11 1major minor patch
Elastica• Community-driven PHP client for Elasticsearch: ruflin/Elastica• Built on top of official low-level client• Object-oriented instead of using associative arrays
Elastica
FOSElasticaBundle• Integrates the Elastica library into a Symfony environment• Use JmsSerializer or Symfony Serializer to convert betweenPHP objects and Elasticsearch data• Index configuration for Elasticsearch, or send data withoutconfiguration to use the dynamic mapping feature ofElasticsearch• Listeners for Doctrine events for automatic indexing
FOSElasticaBundleElasticsearch7.x
FOSElasticaBundle
Demo
Controller
Doctrine entity class
Datafixtures
Elasticsearch index configuration
Aliased Indexes
Aliased Indexes• talk_2021-02-26-182155• talk_2021-03-12-104500• talk_2021-03-12-112000← talk
Mappings
Populating
Searching via CLI
Searching via controller
Autowiring
Searching for "Sebastian"
Searching for "Symfony"
Searching for "Kuba"
Searching for "Jakub"
Synonyms
Kuba != Kuba
Tajemnica turkusowego łabędzia
Morfologik Polish Lemmatizer plugin for Elasticsearch
Hosting
Docker
SymfonyCloudLatest is 7.11
Elastic Cloud
Want more?
Elastic Logs
Elastic Metrics
Elastic APM
Q&A
Thank you!