Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021

Elasticsearch + Symfony @ SymfonyLive Online Polish Edition 2021

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.

Sebastian Grodzicki

March 12, 2021
Tweet

More Decks by Sebastian Grodzicki

Other Decks in Programming

Transcript

  1. $ whoami
    Sebastian Grodzicki

    • Senior Engineering Manager at


    • ex-CTO at GoldenLine & SHOWROOM


    • SensioLabs Certi
    fi
    ed Symfony Developer


    @sebgrodzicki

    View full-size slide

  2. Elastic Stack

    View full-size slide

  3. O
    ffi
    cial low-level client for Elasticsearch
    • O
    ffi
    cial PHP client for Elasticsearch: elastic/elasticsearch-php


    • Updated and released with the Elastic Stack version


    • Uses connection pool for cluster con
    fi
    guration


    • Exposes the Elasticsearch APIs using functions of a Client class


    • Each function returns the body of a HTTP response from
    Elasticsearch or a boolean value for HEAD API (e.g., Index exists
    API)

    View full-size slide

  4. O
    ffi
    cial low-level client for Elasticsearch

    View full-size slide

  5. .
    .
    Semantic Versioning
    7 11 1
    major minor patch

    View full-size slide

  6. O
    ffi
    cial low-level client for Elasticsearch

    View full-size slide

  7. O
    ffi
    cial low-level client for Elasticsearch

    View full-size slide

  8. O
    ffi
    cial low-level client for Elasticsearch

    View full-size slide

  9. Elastica
    • Community-driven PHP client for Elasticsearch: ru
    fl
    in/
    Elastica


    • Built on top of o
    ffi
    cial low-level client


    • Object-oriented instead of using associative arrays

    View full-size slide

  10. FOSElasticaBundle
    • Integrates the Elastica library into a Symfony environment


    • Use JmsSerializer or Symfony Serializer to convert between
    PHP objects and Elasticsearch data


    • Index con
    fi
    guration for Elasticsearch, or send data without
    con
    fi
    guration to use the dynamic mapping feature of
    Elasticsearch


    • Listeners for Doctrine events for automatic indexing

    View full-size slide

  11. FOSElasticaBundle
    Elasticsearch


    7.x

    View full-size slide

  12. FOSElasticaBundle

    View full-size slide

  13. FOSElasticaBundle

    View full-size slide

  14. FOSElasticaBundle

    View full-size slide

  15. Doctrine entity class

    View full-size slide

  16. Data
    fi
    xtures

    View full-size slide

  17. Elasticsearch index con
    fi
    guration

    View full-size slide

  18. Aliased Indexes

    View full-size slide

  19. Aliased Indexes
    • talk_2021-02-26-182155


    • talk_2021-03-12-104500


    • talk_2021-03-12-112000
    ← talk

    View full-size slide

  20. Searching via CLI

    View full-size slide

  21. Searching via controller

    View full-size slide

  22. Searching for "Sebastian"

    View full-size slide

  23. Searching for "Symfony"

    View full-size slide

  24. Searching for "Kuba"

    View full-size slide

  25. Searching for "Jakub"

    View full-size slide

  26. Searching for "Jakub"

    View full-size slide

  27. Kuba != Kuba

    View full-size slide

  28. Tajemnica turkusowego łabędzia

    View full-size slide

  29. Tajemnica turkusowego łabędzia

    View full-size slide

  30. Tajemnica turkusowego łabędzia

    View full-size slide

  31. Tajemnica turkusowego łabędzia

    View full-size slide

  32. Tajemnica turkusowego łabędzia

    View full-size slide

  33. Tajemnica turkusowego łabędzia

    View full-size slide

  34. Tajemnica turkusowego łabędzia

    View full-size slide

  35. Morfologik Polish Lemmatizer plugin for Elasticsearch

    View full-size slide

  36. Morfologik Polish Lemmatizer plugin for Elasticsearch

    View full-size slide

  37. Morfologik Polish Lemmatizer plugin for Elasticsearch

    View full-size slide

  38. SymfonyCloud
    Latest is 7.11

    View full-size slide

  39. Elastic Cloud

    View full-size slide

  40. Elastic Logs

    View full-size slide

  41. Elastic Metrics

    View full-size slide