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

Recherche avancée pour votre application "legac...

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.
Avatar for Elastic Co Elastic Co
December 01, 2016

Recherche avancée pour votre application "legacy" - ElsassJUG

Comment mixer SQL et NoSQL sans faire la révolution ?

Cette "live coding" conférence vous montrera comment ajouter Elasticsearch à votre application existante sans changer vos habitudes. Vous aurez des fonctions de recherche avancées sans avoir à écrire du SQL complexe !

David partira d'une application RestX, Hibernate et MySQL et ajoutera Elasticsearch en live depuis la scène !

Talk give at ElsassJUG, Strasbourg
https://www.meetup.com/fr-FR/ElsassJUG/events/235671400/

Avatar for Elastic Co

Elastic Co

December 01, 2016
Tweet

More Decks by Elastic Co

Other Decks in Programming

Transcript

  1. 4

  2. 5 The only Elasticsearch as a Service offering powered by

    the creators of the Elastic Stack • Always runs on the latest software • One-click to scale/upgrade with no downtime • Free Kibana and backups every 30 minutes • Dedicated, SLA-based support • Easily add X-Pack features: security (Shield), alerting (Watcher), and monitoring (Marvel) • Pricing starts at $45 a month
  3. Elastic Subscription Packages 6 Elastic Stack BASIC GOLD PLATINUM Elasticsearch,Kibana,

    Logstash, Beats ✓ ✓ ✓ X-Pack Marvel (Monitoring & Management) ✓ ✓ Multicluster Support >7 days data retention ✓ Multicluster Support >7 days data retention Shield (Security) ✓ ✓ Field/document security Custom realms Watcher (Alerting) ✓ ✓ Reporting ✓ ✓ Graph Analytics & Visualization ✓ Support Support coverage and response times provided by Elastic Support Engineers Business Hours 4 hour L1 response times 24/7/365 1 hour L1 response times Emergency patches
  4. 7

  5. Some data CREATE TABLE user ( name VARCHAR(100), comments VARCHAR(1000)

    ); INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Docker'); INSERT INTO user VALUES ('David David', 'Who is that guy?'); 12
  6. Search on term SELECT * FROM user WHERE name="David"; Empty

    set (0,00 sec) INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Docker'); INSERT INTO user VALUES ('David David', 'Who is that guy?'); 13
  7. Search like SELECT * FROM user WHERE name LIKE "%David%";

    +--------------+----------------------+ | name | comments | +--------------+----------------------+ | David Pilato | Developer at elastic | | David Gageot | Engineer at Docker | | David David | Who is that guy? | +--------------+----------------------+ INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Docker'); INSERT INTO user VALUES ('David David', 'Who is that guy?'); 14
  8. Search like SELECT * FROM user WHERE name LIKE "%David%Pilato%";

    +--------------+----------------------+ | name | comments | +--------------+----------------------+ | David Pilato | Developer at elastic | +--------------+----------------------+ INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Docker'); INSERT INTO user VALUES ('David David', 'Who is that guy?'); 15
  9. Search like with inverted terms SELECT * FROM user WHERE

    name LIKE "%Pilato%David%"; Empty set (0,00 sec) INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Docker'); INSERT INTO user VALUES ('David David', 'Who is that guy?'); 16
  10. Search in two fields SELECT * FROM user WHERE name

    LIKE "%David%" OR comments LIKE "%David%"; +--------------+---------------------------------------------+ | name | comments | +--------------+---------------------------------------------+ | David Pilato | Developer at elastic | | Malloum Laya | Worked with David at french customs service | | David Gageot | Engineer at Docker | | David David | Who is that guy? | +--------------+---------------------------------------------+ INSERT INTO user VALUES ('David Pilato', 'Developer at elastic'); INSERT INTO user VALUES ('Malloum Laya', 'Worked with David at french customs service'); INSERT INTO user VALUES ('David Gageot', 'Engineer at Docker'); INSERT INTO user VALUES ('David David', 'Who is that guy?'); 17
  11. DATABASE SQL ETL using a ETL WEB APP HTTP /

    REST JDBC ELASTICSEARCH REST / JSON 22
  12. think document! • Change your mindset: ‒ Forget SQL! ‒

    Index what you want to find • A document ‒ A JSON object ‒ Core field types (string, numbers, booleans) ‒ Complex field types (arrays, objects) ‒ Additional field types (geo points, geo shapes) 23 23
  13. DATABASE SQL direct connection WEB APP HTTP / REST JDBC

    ES-CLIENT ELASTICSEARCH REST / JSON 25
  14. JSON document design PUT /person/person/1 { "name":"Joe Pink", "dateOfBirth":"1971-12-26", "address_id":"2",

    "marketing_id":"3" } PUT /person/address/2 { "city":"Paris", "country":"France" } PUT /person/marketing/3 { "cars":1000, "food":1500 } 26
  15. JSON document design PUT /person/person/1 { "name":"Joe Pink", "dateOfBirth":"1971-12-26", "address":{

    "city":"Paris", "country":"France" }, "marketing":{ "cars":1000, "food":1500 } } 27
  16. direct connection demo time $ git clone https://github.com/dadoonet/legacy-search.git $ git

    checkout 01-direct $ git checkout 02-bulk $ git checkout 03-mapping $ git checkout 04-aggs $ git checkout 05-compute $ mvn clean install jetty:run $ cat README.markdown 28
  17. DATABASE SQL using brokers WEB APP HTTP / REST JDBC

    ES-CLIENT ELASTICSEARCH REST / JSON 30
  18. ELASTICSEARCH REST / JSON using brokers WEB APP HTTP /

    REST JDBC ES-CLIENT DATABASE SQL 31
  19. ELASTICSEARCH REST / JSON using brokers WEB APP HTTP /

    REST JDBC ES-CLIENT DATABASE SQL 32
  20. 33