ElasticSearch is an open-source, distributed, and RESTful search engine built based on Lucene. Designed for cloud computing, it can achieve real-time search, stability, reliability, and speed. 1. wgethttp: // download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-i586.rpm? Authpartam = 1416
ElasticSearch is an open-source, distributed, and RESTful search engine built based on Lucene. Designed for cloud computing, it can achieve real-time search, stable, reliable, fast, and easy to install and use.
1. wget http://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-i586.rpm? AuthParam = 1416296390_276056c6b0870494311edae301500e4f
2, sudo rpm-ivh jdk-7u71-linux-i586.rpm
3. which java
4. vi ~ /. Bash_profile
Export JAVA_HOME =/usr/java/jdk1.7.0 _ 71
Export CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
Export PATH = $ PATH: $ HOME/bin: $ JAVA_HOME/bin
5. source ~ /. Bash_profile & java-version
6. wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.0.tar.gz
7. tar zxf elasticsearch-1.4.0.tar.gz & cd elasticsearch-1.4.0/config
8. vim elasticsearch. yml
Node. name: "hiwechat"
Index. number_of_shards: 10
Index. number_of_replicas: 1
9. cd ../bin
10./elasticsearch-d
11. telnet 127.0.0.1 9300
12../plugin-install medcl/elasticsearch-analysis-ik/1.2.6
13. cd ../config/
14. wget http://github.com/downloads/medcl/elasticsearch-analysis-ik/ik.zip
15. unzip ik.zip
16. rm-rf ik.zip
Other: https://github.com/medcl/elasticsearch-rtf
17. yum install python-pip
18. pip install argparse
19. pip install elasticsearch
20. curl-x get localhost: 9200
21. python
>>> from datetime import datetime
>>> From elasticsearch import Elasticsearch
# By default we connect to localhost: 9200
>>> Es = Elasticsearch ()
# Create an index in elasticsearch, ignore status code 400 (index alreadyexists)
>>> Es. indices. create (index = 'My-Index', ignore = 400)
{U'acknodgdged': True}
# Datetimes will be serialized
>>> Es. index (index = "my-index", doc_type = "test-type", id = 42, body = {"any": "data", "timestamp": datetime. now ()})
{U' _ id': u'42 ', u' _ INDEX': u'my-Index', u' _ type': u'test-type ', u' _ version': 1, u' OK ': True}
# But not deserialized
>>> Es. get (index = "my-index", doc_type = "test-type", id = 42) ['_ source']
{U'any': u'data', u'timestamp': u'2017-05-12T19: 45: 100 '}