ElasticSearch 101

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
John Beynon
November 27, 2012

ElasticSearch 101

My ElasticSearch 101 presentation to the Surrey Ruby User Group, Nov 27th 2012.

John Beynon

November 27, 2012

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

39 slides
  1. $ curl -XPUT http://localhost:9200/twitter/user/kimchy -d '{ "name" : "Shay Banon"

    }' $ curl -XPUT http://localhost:9200/twitter/tweet/1 -d '{ "user": "kimchy", "post_date": "2009-11-15T13:12:00", "message": "Trying out elasticsearch, so far so good?" }' $ curl -XPUT http://localhost:9200/twitter/tweet/2 -d '{ "user": "kimchy", "post_date": "2009-11-15T14:12:12", "message": "You know, for Search" }' Wednesday, 28 November 12
  2. $ curl -XPUT http://localhost:9200/twitter $ curl -XPUT http://localhost:9200/twitter/user/_mapping -d '{

    "user" : { "properties" : { "name" : { "type" : "string" } } } }' Wednesday, 28 November 12
  3. { "tweet" : { "properties" : { "user" : {"type"

    : "string", "index" : "not_analyzed"}, "message" : {"type" : "string", "null_value" : "na"}, "postDate" : {"type" : "date"}, "priority" : {"type" : "integer"}, "rank" : {"type" : "float"} } } } Wednesday, 28 November 12
  4. $ curl -XGET http://localhost:9200/twitter/tweet/ _search?q=user:kimchy $ curl -XGET http://localhost:9200/twitter/tweet/_search -d

    '{ "query" : { "term" : { "user": "kimchy" } } }' $ curl -XGET http://localhost:9200/twitter/_search? pretty=true -d '{ "query" : { "range" : { "post_date" : { "from" : "2009-11-15T13:00:00", "to" : "2009-11-15T14:30:00" } } } }' Wednesday, 28 November 12
  5. $ curl -XPUT http://localhost:9200/elasticsearch/tweet/1 -d '{ "post_date": "2009-11-15T14:12:12", "message": "Zug

    Zug", "tag": "warcraft" }' $ curl -XPUT http://localhost:9200/kimchy/tweet/1 -d '{ "post_date": "2009-11-15T14:12:12", "message": "Whatyouwant?", "tag": "warcraft" }' $ curl -XGET http://localhost:9200/kimchy,elasticsearch/ tweet/_search?q=tag:warcraft Wednesday, 28 November 12
  6. $ curl -XPUT http://localhost:9200/elasticsearch/ -d '{ "settings" : { "number_of_shards"

    : 2, "number_of_replicas" : 3 } }' Wednesday, 28 November 12
  7. select " pt.code as pt_code, " pt.name as pt_name, "

    array_agg(DISTINCT hlt.code) as high_level_term_codes, " array_agg(DISTINCT hlgt.code) as high_level_group_term_codes, " soc.code as soc_code, " lang.name as language, " lang.meddra_version as meddra_version " ... Wednesday, 28 November 12
  8. { "low_level_term" : { " " " “id” : “10049364_”

    " "name" : "Bleeding lips", " "llt_code" : “10049364", " " " "soc_code” : “10017947", " "high_level_term_codes" : [ "123457", " " " " " "932323" " " " ], " " " ... } } Wednesday, 28 November 12

More Decks by John Beynon

Other Decks in Programming