├── .gitignore ├── part-3 ├── quick-brown-fox.txt ├── raposa-rapida.txt ├── surprize-query.json ├── add-new-mapping.json ├── surprize-fuzzy-query.json └── load-surprise-data.sh ├── part-1 ├── empty-query.json ├── last-name-query.json ├── full-text-search.json ├── phrase-search.json ├── first-blog-post.json ├── second-blog-post.json ├── updated-blog-post.json ├── douglas-fir.json ├── jane-smith.json ├── john-smith.json └── last-name-age-query.json ├── part-2 ├── elasticsearch-tweets-query.json ├── best-selling-car-color.json ├── user-id-filter.json ├── car-sales-per-month.json ├── date-filter.json ├── average-car-color-price.json ├── filtered-tweet-query.json ├── car-revenue-histogram.json ├── combining-tweet-queries.json ├── load-tweet-data.sh └── load-car-data.sh ├── Dockerfile ├── Vagrantfile ├── LICENSE ├── provisioner.sh └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | 3 | -------------------------------------------------------------------------------- /part-3/quick-brown-fox.txt: -------------------------------------------------------------------------------- 1 | The quick brown fox jumped over the lazy dog. 2 | -------------------------------------------------------------------------------- /part-1/empty-query.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "match_all": {} 4 | } 5 | } -------------------------------------------------------------------------------- /part-3/raposa-rapida.txt: -------------------------------------------------------------------------------- 1 | A rápida raposa marrom pulou sobre o cachorro preguiçoso. 2 | -------------------------------------------------------------------------------- /part-1/last-name-query.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "match": { 4 | "last_name": "Smith" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /part-1/full-text-search.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "match": { 4 | "about": "rock climbing" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /part-1/phrase-search.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "match_phrase": { 4 | "about": "rock climbing" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /part-2/elasticsearch-tweets-query.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "match": { 4 | "tweet": "elasticsearch" 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM elasticsearch 2 | MAINTAINER Rafael Gomes 3 | CMD ["elasticsearch","-Des.network.host=0.0.0.0"] 4 | -------------------------------------------------------------------------------- /part-1/first-blog-post.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "My first blog post", 3 | "text": "Just trying this out...", 4 | "date": "2014-01-01" 5 | } -------------------------------------------------------------------------------- /part-1/second-blog-post.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Second blog post", 3 | "text": "Still trying this out...", 4 | "date": "2014-01-01" 5 | } -------------------------------------------------------------------------------- /part-3/surprize-query.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "match": { 4 | "text": { 5 | "query": "surprize" 6 | } 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /part-1/updated-blog-post.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "My first blog post", 3 | "text": "I am starting to get the hang of this...", 4 | "date": "2014-01-02" 5 | } -------------------------------------------------------------------------------- /part-2/best-selling-car-color.json: -------------------------------------------------------------------------------- 1 | { 2 | "aggs" : { 3 | "colors" : { 4 | "terms" : { 5 | "field" : "color" 6 | } 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /part-1/douglas-fir.json: -------------------------------------------------------------------------------- 1 | { 2 | "first_name": "Douglas", 3 | "last_name": "Fir", 4 | "age": 35, 5 | "about": "I like to build cabinets", 6 | "interests": ["forestry"] 7 | } -------------------------------------------------------------------------------- /part-1/jane-smith.json: -------------------------------------------------------------------------------- 1 | { 2 | "first_name": "Jane", 3 | "last_name": "Smith", 4 | "age": 32, 5 | "about": "I like to collect rock albums", 6 | "interests": ["music"] 7 | } -------------------------------------------------------------------------------- /part-1/john-smith.json: -------------------------------------------------------------------------------- 1 | { 2 | "first_name": "John", 3 | "last_name": "Smith", 4 | "age": 25, 5 | "about": "I love to go rock climbing", 6 | "interests": ["sports", "music"] 7 | } -------------------------------------------------------------------------------- /part-3/add-new-mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": { 3 | "description": { 4 | "type": "string", 5 | "index": "analyzed", 6 | "analyzer": "english" 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /part-2/user-id-filter.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "filtered": { 4 | "filter": { 5 | "term": { 6 | "user_id": 1 7 | } 8 | } 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /part-3/surprize-fuzzy-query.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "match": { 4 | "text": { 5 | "query": "surprize", 6 | "fuzziness": "1" 7 | } 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /part-2/car-sales-per-month.json: -------------------------------------------------------------------------------- 1 | { 2 | "aggs": { 3 | "sales": { 4 | "date_histogram": { 5 | "field": "sold", 6 | "interval": "month", 7 | "format": "yyyy-MM-dd" 8 | } 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /part-2/date-filter.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "filtered": { 4 | "filter": { 5 | "range": { 6 | "date": { 7 | "gte": "2014-09-20" 8 | } 9 | } 10 | } 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /part-2/average-car-color-price.json: -------------------------------------------------------------------------------- 1 | { 2 | "aggs": { 3 | "colors": { 4 | "terms": { "field": "color" }, 5 | "aggs": { 6 | "avg_price": { 7 | "avg": { "field": "price" } 8 | } 9 | } 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure(2) do |config| 5 | config.vm.box = "ubuntu/trusty64" 6 | config.vm.network "forwarded_port", guest: 9200, host: 9200, auto_correct: true 7 | config.vm.provision "shell", path: "provisioner.sh" 8 | end 9 | -------------------------------------------------------------------------------- /part-2/filtered-tweet-query.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "filtered": { 4 | "query": { 5 | "match": { 6 | "tweet": "elasticsearch" 7 | } 8 | }, 9 | "filter": { 10 | "term": { 11 | "user_id": 1 12 | } 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /part-1/last-name-age-query.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "filtered": { 4 | "filter": { 5 | "range": { 6 | "age": { "gt": 30 } 7 | } 8 | }, 9 | "query": { 10 | "match": { 11 | "last_name": "Smith" 12 | } 13 | } 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /part-2/car-revenue-histogram.json: -------------------------------------------------------------------------------- 1 | { 2 | "aggs": { 3 | "price": { 4 | "histogram": { 5 | "field": "price", 6 | "interval": 20000 7 | }, 8 | "aggs": { 9 | "revenue": { 10 | "sum": { 11 | "field" : "price" 12 | } 13 | } 14 | } 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /part-2/combining-tweet-queries.json: -------------------------------------------------------------------------------- 1 | { 2 | "query": { 3 | "bool": { 4 | "must": { 5 | "match": { "tweet": "elasticsearch"} 6 | }, 7 | "must_not": { 8 | "match": { "name": "mary" } 9 | }, 10 | "should": { 11 | "match": { "tweet": "full text" } 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /part-3/load-surprise-data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export HOST=localhost # for Vagrant, Docker (Linux) or local installs 4 | # export HOST=192.168.99.100 # for Docker on the Mac 5 | 6 | curl -X POST "http://$HOST:9200/example/surprise/_bulk?pretty" -d' 7 | { "index": { "_id": 1 }} 8 | { "text": "Surprise me!"} 9 | { "index": { "_id": 2 }} 10 | { "text": "That was surprising."} 11 | { "index": { "_id": 3 }} 12 | { "text": "I was not surprised."} 13 | ' -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Felipe Dornelas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /provisioner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | 6 | is_package_present() { 7 | PKG_OK=$(dpkg-query -W --showformat='${Status}\n' "$1" | grep "install ok installed") 8 | if [ "" = "$PKG_OK" ]; then 9 | return 1 10 | else 11 | return 0 12 | fi 13 | } 14 | 15 | install_package() { 16 | sudo apt-get install -y "$1" 17 | } 18 | 19 | install_java8() { 20 | if is_package_present oracle-java8-installer; then 21 | echo "Package oracle-java8-installer already installed" 22 | else 23 | sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list 24 | sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list 25 | sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 26 | sudo apt-get -y update 27 | sudo echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | tee /etc/oracle-java-8-licence-acceptance | /usr/bin/debconf-set-selections 28 | install_package oracle-java8-installer 29 | fi 30 | } 31 | 32 | install_elasticsearch() { 33 | if is_package_present elasticsearch; then 34 | echo "Package elasticsearch already installed" 35 | else 36 | wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - 37 | echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list 38 | sudo apt-get -y update 39 | install_package elasticsearch 40 | sudo update-rc.d elasticsearch defaults 95 10 41 | sudo service elasticsearch restart 42 | fi 43 | } 44 | 45 | sudo apt-get -y update 46 | install_java8 47 | install_elasticsearch 48 | -------------------------------------------------------------------------------- /part-2/load-tweet-data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export HOST=localhost # for Vagrant or local installs 4 | # export HOST=192.168.99.100 # for Docker 5 | 6 | curl -XPUT "http://$HOST:9200/us/user/1?pretty=1" -d ' 7 | { 8 | "email" : "john@smith.com", 9 | "name" : "John Smith", 10 | "username" : "@john" 11 | }' 12 | 13 | curl -XPUT "http://$HOST:9200/gb/user/2?pretty=1" -d ' 14 | { 15 | "email" : "mary@jones.com", 16 | "name" : "Mary Jones", 17 | "username" : "@mary" 18 | }' 19 | 20 | curl -XPUT "http://$HOST:9200/gb/tweet/3?pretty=1" -d ' 21 | { 22 | "date" : "2014-09-13", 23 | "name" : "Mary Jones", 24 | "tweet" : "Elasticsearch means full text search has never been so easy", 25 | "user_id" : 2 26 | }' 27 | 28 | curl -XPUT "http://$HOST:9200/us/tweet/4?pretty=1" -d ' 29 | { 30 | "date" : "2014-09-14", 31 | "name" : "John Smith", 32 | "tweet" : "@mary it is not just text, it does everything", 33 | "user_id" : 1 34 | }' 35 | 36 | curl -XPUT "http://$HOST:9200/gb/tweet/5?pretty=1" -d ' 37 | { 38 | "date" : "2014-09-15", 39 | "name" : "Mary Jones", 40 | "tweet" : "However did I manage before Elasticsearch?", 41 | "user_id" : 2 42 | }' 43 | 44 | curl -XPUT "http://$HOST:9200/us/tweet/6?pretty=1" -d ' 45 | { 46 | "date" : "2014-09-16", 47 | "name" : "John Smith", 48 | "tweet" : "The Elasticsearch API is really easy to use", 49 | "user_id" : 1 50 | }' 51 | 52 | curl -XPUT "http://$HOST:9200/gb/tweet/7?pretty=1" -d ' 53 | { 54 | "date" : "2014-09-17", 55 | "name" : "Mary Jones", 56 | "tweet" : "The Query DSL is really powerful and flexible", 57 | "user_id" : 2 58 | }' 59 | 60 | curl -XPUT "http://$HOST:9200/us/tweet/8?pretty=1" -d ' 61 | { 62 | "date" : "2014-09-18", 63 | "name" : "John Smith", 64 | "user_id" : 1 65 | }' 66 | 67 | curl -XPUT "http://$HOST:9200/gb/tweet/9?pretty=1" -d ' 68 | { 69 | "date" : "2014-09-19", 70 | "name" : "Mary Jones", 71 | "tweet" : "Geo-location aggregations are really cool", 72 | "user_id" : 2 73 | }' 74 | 75 | curl -XPUT "http://$HOST:9200/us/tweet/10?pretty=1" -d ' 76 | { 77 | "date" : "2014-09-20", 78 | "name" : "John Smith", 79 | "tweet" : "Elasticsearch surely is one of the hottest new NoSQL products", 80 | "user_id" : 1 81 | }' 82 | 83 | curl -XPUT "http://$HOST:9200/gb/tweet/11?pretty=1" -d ' 84 | { 85 | "date" : "2014-09-21", 86 | "name" : "Mary Jones", 87 | "tweet" : "Elasticsearch is built for the cloud, easy to scale", 88 | "user_id" : 2 89 | }' 90 | 91 | curl -XPUT "http://$HOST:9200/us/tweet/12?pretty=1" -d ' 92 | { 93 | "date" : "2014-09-22", 94 | "name" : "John Smith", 95 | "tweet" : "Elasticsearch and I have left the honeymoon stage, and I still love her.", 96 | "user_id" : 1 97 | }' 98 | 99 | curl -XPUT "http://$HOST:9200/gb/tweet/13?pretty=1" -d ' 100 | { 101 | "date" : "2014-09-23", 102 | "name" : "Mary Jones", 103 | "tweet" : "So yes, I am an Elasticsearch fanboy", 104 | "user_id" : 2 105 | }' 106 | 107 | curl -XPUT "http://$HOST:9200/us/tweet/14?pretty=1" -d ' 108 | { 109 | "date" : "2014-09-24", 110 | "name" : "John Smith", 111 | "tweet" : "How many more cheesy tweets do I have to write?", 112 | "user_id" : 1 113 | }' -------------------------------------------------------------------------------- /part-2/load-car-data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export HOST=localhost # for Vagrant or local installs 4 | # export HOST=192.168.99.100 # for Docker 5 | 6 | curl -X POST "http://$HOST:9200/cars/transactions/_bulk?pretty" -d' 7 | { "index": {}} 8 | { "price" : 10000, "color" : "red", "make" : "honda", "sold" : "2014-10-28" } 9 | { "index": {}} 10 | { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } 11 | { "index": {}} 12 | { "price" : 30000, "color" : "green", "make" : "ford", "sold" : "2014-05-18" } 13 | { "index": {}} 14 | { "price" : 15000, "color" : "blue", "make" : "toyota", "sold" : "2014-07-02" } 15 | { "index": {}} 16 | { "price" : 12000, "color" : "green", "make" : "toyota", "sold" : "2014-08-19" } 17 | { "index": {}} 18 | { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } 19 | { "index": {}} 20 | { "price" : 80000, "color" : "red", "make" : "bmw", "sold" : "2014-01-01" } 21 | { "index": {}} 22 | { "price" : 25000, "color" : "blue", "make" : "ford", "sold" : "2014-02-12" } 23 | { "index": {}} 24 | { "price" : 10000, "color" : "red", "make" : "honda", "sold" : "2014-10-28" } 25 | { "index": {}} 26 | { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } 27 | { "index": {}} 28 | { "price" : 30000, "color" : "green", "make" : "ford", "sold" : "2014-05-18" } 29 | { "index": {}} 30 | { "price" : 15000, "color" : "blue", "make" : "toyota", "sold" : "2014-07-02" } 31 | { "index": {}} 32 | { "price" : 12000, "color" : "green", "make" : "toyota", "sold" : "2014-08-19" } 33 | { "index": {}} 34 | { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } 35 | { "index": {}} 36 | { "price" : 80000, "color" : "red", "make" : "bmw", "sold" : "2014-01-01" } 37 | { "index": {}} 38 | { "price" : 25000, "color" : "blue", "make" : "ford", "sold" : "2014-02-12" } 39 | { "index": {}} 40 | { "price" : 10000, "color" : "red", "make" : "honda", "sold" : "2014-10-28" } 41 | { "index": {}} 42 | { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } 43 | { "index": {}} 44 | { "price" : 30000, "color" : "green", "make" : "ford", "sold" : "2014-05-18" } 45 | { "index": {}} 46 | { "price" : 15000, "color" : "blue", "make" : "toyota", "sold" : "2014-07-02" } 47 | { "index": {}} 48 | { "price" : 12000, "color" : "green", "make" : "toyota", "sold" : "2014-08-19" } 49 | { "index": {}} 50 | { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } 51 | { "index": {}} 52 | { "price" : 80000, "color" : "red", "make" : "bmw", "sold" : "2014-01-01" } 53 | { "index": {}} 54 | { "price" : 25000, "color" : "blue", "make" : "ford", "sold" : "2014-02-12" } 55 | { "index": {}} 56 | { "price" : 10000, "color" : "red", "make" : "honda", "sold" : "2014-10-28" } 57 | { "index": {}} 58 | { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } 59 | { "index": {}} 60 | { "price" : 30000, "color" : "green", "make" : "ford", "sold" : "2014-05-18" } 61 | { "index": {}} 62 | { "price" : 15000, "color" : "blue", "make" : "toyota", "sold" : "2014-07-02" } 63 | { "index": {}} 64 | { "price" : 12000, "color" : "green", "make" : "toyota", "sold" : "2014-08-19" } 65 | { "index": {}} 66 | { "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" } 67 | { "index": {}} 68 | { "price" : 80000, "color" : "red", "make" : "bmw", "sold" : "2014-01-01" } 69 | { "index": {}} 70 | { "price" : 25000, "color" : "blue", "make" : "ford", "sold" : "2014-02-12" } 71 | ' 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Elasticsearch Workshop 2 | ====================== 3 | 4 | A broad and very hands-on Elasticsearch overview in ~4 hours. You're going to learn the core fundamentals of Elasticsearch and also get a glimpse on important *Information Retrieval* and *Distributed Systems* concepts. 5 | 6 | You can see the workshop slides at http://speakerdeck.com/felipead/elasticsearch-workshop 7 | 8 | What's covered: 9 | 10 | - Part 1: Core Concepts 11 | - Part 2: Search & Analytics 12 | - Part 3: Dealing with Human Language 13 | - Part 4: Data Modeling 14 | 15 | Environment Setup 16 | ----------------- 17 | 18 | The first step is to download the repository to your machine. If you have [git](http://git-scm.com): 19 | 20 | - `git clone https://github.com/felipead/elasticsearch-workshop` 21 | - `cd elasticsearch-workshop` 22 | 23 | We have provided Vagrant and Docker environments, as well as manual setup instructions. Choose whatever setup is easier for you. 24 | 25 | ### Option 1: Using Vagrant 26 | 27 | - Requirements: 28 | - Install [Vagrant](https://www.vagrantup.com/downloads.html) 29 | - Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) 30 | 31 | - Initialize Vagrant (this will take a while): 32 | - `vagrant up` 33 | 34 | - Verify everything is working: 35 | - `vagrant ssh` 36 | - You might need to wait a few seconds for Elasticsearch to finish booting 37 | - `curl http://localhost:9200` 38 | - It should print something like: 39 | 40 | ```json 41 | { 42 | "name" : "Starbolt", 43 | "cluster_name" : "elasticsearch", 44 | "version" : { 45 | "number" : "2.1.0", 46 | "build_hash" : "72cd1f1a3eee09505e036106146dc1949dc5dc87", 47 | "build_timestamp" : "2015-11-18T22:40:03Z", 48 | "build_snapshot" : false, 49 | "lucene_version" : "5.3.1" 50 | }, 51 | "tagline" : "You Know, for Search" 52 | } 53 | ``` 54 | 55 | ### Option 2: Using Docker 56 | 57 | - Requirements: 58 | - If you are on Linux: 59 | - Install [Docker](https://docs.docker.com/engine/installation/) 60 | - If you are on Windows or Mac: 61 | - Install the [Docker Toolbox](https://www.docker.com/docker-toolbox) 62 | - Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) 63 | 64 | - Run your container: 65 | - `docker run -p 9200:9200 elasticsearch:2.1 elasticsearch -Des.network.host="0.0.0.0"` 66 | 67 | - Verify everything is working: 68 | - If you use Mac or Windows with Toolbox: 69 | - `curl http://192.168.99.100:9200` 70 | - If you use GNU/Linux: 71 | - `curl http://localhost:9200` 72 | - It should print something like: 73 | 74 | ```json 75 | { 76 | "name" : "Starbolt", 77 | "cluster_name" : "elasticsearch", 78 | "version" : { 79 | "number" : "2.1.0", 80 | "build_hash" : "72cd1f1a3eee09505e036106146dc1949dc5dc87", 81 | "build_timestamp" : "2015-11-18T22:40:03Z", 82 | "build_snapshot" : false, 83 | "lucene_version" : "5.3.1" 84 | }, 85 | "tagline" : "You Know, for Search" 86 | } 87 | ``` 88 | ### Option 3: *Fedora / CentOS only* 89 | - Install elasticsearch: 90 | - `sudo dnf install -y elasticsearch` 91 | - Run it: 92 | - `sudo systemctl start elasticsearch` 93 | 94 | ### Option 4: Manual Setup 95 | 96 | - Requirements: 97 | - Install curl: 98 | - If you have Homebrew: `brew install curl` 99 | - ...or install Apple Developer Tools 100 | - Install [JDK](https://jdk8.java.net/download.html) 7 or 8 101 | 102 | - Download [Elasticsearch](https://www.elastic.co/downloads/elasticsearch/) 2.x 103 | - Unzip it to a folder in your machine (ex: `~/elasticsearch-2.1.0`) 104 | 105 | - Start Elasticsearch: 106 | - `${ELASTICSEARCH_HOME}/bin/elasticsearch` 107 | - You might need to wait a few seconds for Elasticsearch to finish booting 108 | 109 | - Verify everything is working: 110 | - `curl http://localhost:9200` 111 | - It should print something like: 112 | 113 | ```json 114 | { 115 | "name" : "Starbolt", 116 | "cluster_name" : "elasticsearch", 117 | "version" : { 118 | "number" : "2.1.0", 119 | "build_hash" : "72cd1f1a3eee09505e036106146dc1949dc5dc87", 120 | "build_timestamp" : "2015-11-18T22:40:03Z", 121 | "build_snapshot" : false, 122 | "lucene_version" : "5.3.1" 123 | }, 124 | "tagline" : "You Know, for Search" 125 | } 126 | ``` 127 | --------------------------------------------------------------------------------