6 September 2011

How to install elasticsearch on windows and with basic usage using cygwin on windows ?

This solution based on 
Elasticsearch 0.13.1 (and 0.17.6) and Cygwin 1.7.0 for WINDOWS

INFORMATION: (This blog entry is out of date! However, here you can find amazing blog entry with simple tutorial about elasticsearch (It works with Elasticsearch 0.90.2) :  http://joelabrahamsson.com/elasticsearch-101/ )


First.... Kimchy (author of Elasticsearch) wrote "First of all, DON’T PANIC. It will take 5 minutes to get the gist of what ElasticSearch is all about." ... and i agree that you will DON'T PANIC ... but ... it will be SHAMBOLIC EXPERIENCE which looks like cleaning after shit hit the fan.

Let's start from install Cygwin first

1. Download Cygiwn from http://www.cygwin.com/ (Main website , press on setup.exe
2. Run setup.exe and press Next
3. Choose Install from Internet (or if you have Cygwin stuff from other resouces use Install from Local directory ). Press Next
4. Set Root Directory ( i suggest to use path without spaces like: C:\cygwin ) and press Next
5. Set Local Package directory (where all downloaded stuff will be stored , I used my installs folder for that (C:\backup\installs\system\ ) and press Next
6. Select you Internet connection (i don't know your internet settings ) and press next
7. Select any ... any mirror (I using cygwin.cict.fr because it usually work.).Some of them doesn't work sometimes or contain accient version of stuff.
8. Enjoy view of progress of the downloading "list of stuff to install".It should takes a little bit.
IN THE END CYGWIN WILL DISPLAY SETUP ALERT ... so don't have a heart attack.It just inform that you install cygwin first time (really? very clever setup , is it ?) and give you advice that you should ignore this message (so why they display as error message in first place,anyway ?)

9. you should install these stuff :
cygutils(Utils)
vim (Editors)
openssh,openssl,inetutils (Net)
curl (Libs,Net,Web)
uzip(Archive) [u can add gzip and other zip utilities]

and press Next

10.Go prepare dinner , solve few sudokus , solve problems with food in afrikca and do other everyday activity , then afrer that Program should finish installation.

11.Press finish Cygwin

DONE! Now time for Elasticsearch

Suggestion ... ignore what is written about installation on http://www.elasticsearch.org/ and follow installation instruction on https://github.com/elasticsearch/elasticsearch.

12. Download elasticsearch from http://www.elasticsearch.org/download/ using your favorite web browser
(u can use cyqwin if you are commandline fanatic,but it can be a little bit tricky if you are not familiar with cygwin and "linux's life style")

13. Unzip (using windows or archvier software like winzip,winrar and etc) or CYGWIN (command unzip )

14. Then run c:/(installation folder)/bin/elasticsearch.bat on windows.

15. Run Cygwin (Menustart > All Proograms > Cygwin > Cygwin Bash Shell

16. curl -X GET http://localhost:9200/

17.
To put stuff
example 1)
curl -XPUT 'http://localhost:9200/blog/user/steven' -d '{ "name" : "Steven Segal" , "usertype" : "Superhero" }'

Respond should looks moreless like that:

{"ok":true,"_index":"blog","_type":"user","_id":"steven"}

example 2a)
curl -XPUT 'http://localhost:9200/blog/steven/2011/001' -d '
{
"user": "steven",
"title": "my dream come true"
"message": "I was hit by train.That was an unforgotten experience for me.I feel now enough powerful to do another romantic comedy movie"
}'

example 2b)
curl -XPUT 'http://localhost:9200/blog/steven/2011/002' -d '
{
"user": "steven",
"title": "hit me baby one more time "
"message": "I have a new next door's imaginary friend."
}'

example 2c)
curl -XPUT 'http://localhost:9200/blog/steven/2011/003' -d '
{
"user": "steven",
"title": "perfection is hard to improve"
"message": "Garfield was right,because i and my movies are perfect and it is hard to improve"
}'


to get stuff

example 1)
curl -XPUT 'http://localhost:9200/blog/user/steven?pretty=true'

Respond should looks moreless like that:
{
"_index" : "blog",
"_type" : "user",
"_id" : "steven", "_source" : {"name" : "Steven segal","usertype": "superhero"
}
}

example 2)
curl -XPUT 'http://localhost:9200/blog/steven/2011/001?pretty=true'
curl -XPUT 'http://localhost:9200/blog/steven/2011/002?pretty=true'
curl -XPUT 'http://localhost:9200/blog/steven/2011/003?pretty=true'
(btw. ?pretty=true is added to display result more nicely)

to search stuff

Answer will looks something like that (moreless)
'
{
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.19178301,
"hits" : [ {
"_index" : "blog",
"_type" : "user",
"_id" : "steven",
"_score" : 0.19178301, "_source" : {"name" : "Steven segal","usertype": "superhero"}
} ]
}
}

GOOD LUCK WITH USING ELASTICSEARCH ... REALLY BIG ... HUGE VERY GOOD LUCK with ELASTICSEARCH and improve your patience skills you will need a lot.

BTW. my favorite part found on elasticsearch website

Where to go from here?
We have just covered a very small portion of what ElasticSearch is all about. For more information, please refer to: .
Yes. "a space" is an answer. There is no way to go from there.




if you have any troubles with cygwin. Look to this website : http://www.cygwin.com/faq/faq.setup.html
if you have any troubles with elasticsearc. You are srcrewed up.


Source:

http://www.elasticsearch.org/ (with crap installation guide )

https://github.com/elasticsearch (with useful installation guide)

http://www.cygwin.com/faq/faq.using.html (useful stuff there if you have problems with cygwin)