Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ElasticSearch: la tenés atroden Google

2,738 views

Published on

  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

ElasticSearch: la tenés atroden Google

  1. 1. BarCamp BA 2012 @mgiglesias ElasticSearch La tenés atroden Google
  2. 2. $ who am i● @mgiglesias● C++, Node.js, Python, PHP● Open source● NodoJS y GrupoPHP● WORKANA → www.workana.com
  3. 3. En tu cara Google
  4. 4. ¿Me ponés un buscadorcito?● Los que merecen ser exterminados – Usá LIKE. Es fácil.● Los que te odian – MySQL FULL TEXT● Los que piensan que The Matrix está basada en hechos reales – Creá tu propio indexador● Los que te quieren. Un poquito nomás. – Sphinx● Los que te quieren ver destronar a Zuckerberg. Y te ayudan a hacerlo. – ElasticSearch papá.
  5. 5. ¿¿¿¿Java == Diversión????
  6. 6. Te empieza a gustar● Montado sobre Lucene● “Schema-free”● REST – ¡Hasta la configuración!● Múltiples índices (y poder buscar a través)● Casi super requete-recontra real time● Super requete-recontra distribuido● Una papa de instalar, integrar, y escalar● El tipo que lo creó es un loco de la guerra (@kimchy)
  7. 7. Conceptos● Nodos● Índices● Tipos● Documentos
  8. 8. <3 REST Índice IDcurl -XPUT http://localhost:9200/articulos/articulo/1 -d { "titulo": "Buenas cervezas", Tipo "contenido": "Todas. Menos Budweiser.", "tags": ["cerveza", "budweiser"]} Le pasás JSONcurl -XGET http://localhost:9200/articulos/articulo/_search?q=cerveza&pretty API Te devuelve JSON
  9. 9. Obtener documentocurl -XGET http://localhost:9200/articulos/articulo/1?pretty { "_index" : "articulos", "_type" : "articulo", "_id" : "1", "_version" : 1, "exists" : true, "_source" : { "titulo":"Buenas cervezas", "contenido":"Todas. Menos Budweiser." }
  10. 10. Actualizar documentocurl -XPUT http://localhost:9200/articulos/articulo/1 -d { "titulo": "Buenas cervezas", "contenido": "Todas. Menos Budweiser. Tampoco Schneider.", "tags" ["cerveza", "budweiser", "schneider"]} { "ok":true, "_index":"articulos", "_type":"articulo", "_id":"1", "_version":2 }
  11. 11. ¿Simplemente un buscador?curl -XGET http://localhost:9200/_all/articulo/_search?q=cerveza Busco todos los índicescurl -XGET http://localhost:9200/articulos/articulo,autor/_search?q=name:X Busco varios tipos de datos
  12. 12. Tipos de datos● Quiero tener algunos elementos del documento no indexables● Quiero poder buscar, agregar filtros, y ordenar● Datos simples: string, integer, long, float, double, boolean, null● Datos compuestos: array, object● boost● include_in_all
  13. 13. 0, 0, 0curl -XDELETE http://localhost:9200/articuloscurl -XPUT http://localhost:9200/articuloscurl -XPUT http://localhost:9200/articulos/articulo/_mapping -d { "articulo": { "properties": { "titulo": {"type":"string"}, "pais": {"type":"string", "include_in_all":false}, "contenido": {"type":"string"}, "publicado": {"type":"date", "format": "yyyy-MM-dd HH:mm:ss"}, "tags": {"type":"string"}, "rating": {"type":"object", "properties":{ "promedio": {"type": "float"}, "total": {"type": "long"} }} }}}
  14. 14. Filtroscurl -XPUT http://localhost:9200/articulos/articulo/1 -d { "titulo": "Buenas cervezas", "contenido": "Todas. Menos Budweiser.", "publicado": "2012-11-04 06:43:00", "tags": ["cerveza", "budweiser"], "rating": {"promedio": 8.7, "total": 15}}curl -XGET http://localhost:9200/articulos/articulo/_search?q=cerveza -d { "filter": { "range": {"rating.total": {"from": 10}} }}
  15. 15. Filtros● limit● and, or, not● exists● geo_distance, geo_distance_range, geo_bbox, geo_shape, …● range, numeric_range● has_parent, has_child
  16. 16. Mejorando la búsqueda● Query en el POST● query_string● field● bool: must, must_not● fuzzy● wildcard
  17. 17. Facets
  18. 18. Rivers● Consume datos (los trae o los recibe) y los mete en ES● Rivers – CouchDB – RabbitMQ – Twitter – Wikipedia● Community – MongoDB – JDBC
  19. 19. Percolator● Almaceno una query (en un índice)● Ejecuto esa query (_percolate) sobre un documento – ¡No almacena el documento en el índice!● Me dice que queries matchearon● Ejemplo: tweets que matcheen una búsqueda, a medida que vienen● Como almaceno queries, puedo filtrar que queries se ejecutan (wow)
  20. 20. Super requete-recontra escalable● Shards: parte de los documentos (cada uno es un índice Lucene). Se shardea por _id – En cuantas “partes” queremos dividir los datos – Si un nodo se cae, todavía tenemos parte de los datos – Más shards, mejor indexing● Cada shard puede tener réplicas (que se pueden crear dinamicamente!) – Copias. Si se caen varios shards, aun podemos tener toda la data – Más replicas, mejor búsqueda
  21. 21. Super requete-recontra escalable Shard 1 Replica 1 Shard 2 Replica 2Articulo 1 Articulo 1 Articulo 2 Articulo 2Articulo 3 Articulo 3 Articulo 4 Articulo 4 Query para artículos 1, 2, 4
  22. 22. Una tormenta de magia● Discovery: identificar nodos, y seleccionar nodo master● El master mantiene el estado del cluster, y reasigna shards si nodos entran / se van● Los nodos responden a los requests (no van a master)● Un nodo sabe si puede responder un request, y si no lo delega● Auto-discovery por Zen o EC2
  23. 23. Persistent storage● La info sobre un nodo es temporaria – JVM heap (ojo!)● Persistent: para estado del cluster e indices● Permite un full recovery si se restartea el cluster● Gateways soportados: – FS local o compartido – Hadoop via HDFS – S3
  24. 24. API● _search: errr... buscar :)● _status: te da información sobre un índice● _refresh: refrescar indices● _optimize: optimizar en Lucene● _mapping: crear un tipo de datos
  25. 25. BarCamp BA 2012 @mgiglesias ¿Preguntas?

×