|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
欢迎大家来到仓酷云论坛!ElasticSearch是一个基于Lucene构建的开源,散布式,RESTful搜刮引擎。计划用于云盘算中,可以到达及时搜刮,不乱,牢靠,疾速,装置利用便利.
1、wgethttp://download.oracle.com/otn-pub/java/jdk/7u71-b14/jdk-7u71-linux-i586.rpm?AuthParam=1416296390_276056c6b0870494311edae301500e4f
2、sudorpm-ivhjdk-7u71-linux-i586.rpm
3、whichjava
4、vi~/.bash_profile
exportJAVA_HOME=/usr/java/jdk1.7.0_71
exportCLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
exportPATH=$PATH:$HOME/bin:$JAVA_HOME/bin
5、source~/.bash_profile&&java–version
6、wgethttps://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.0.tar.gz
7、tarzxfelasticsearch-1.4.0.tar.gz&&cdelasticsearch-1.4.0/config
8、vimelasticsearch.yml
node.name:"hiwechat"
index.number_of_shards:10
index.number_of_replicas:1
9、cd../bin
10、./elasticsearch–d
11、telnet127.0.0.19300
12、./plugin-installmedcl/elasticsearch-analysis-ik/1.2.6
13、cd../config/
14、wgethttp://github.com/downloads/medcl/elasticsearch-analysis-ik/ik.zip
15、unzipik.zip
16、rm-rfik.zip
other:https://github.com/medcl/elasticsearch-rtf
17、yuminstallpython-pip
18、pipinstallargparse
19、pipinstallelasticsearch
20、curl-XGETlocalhost:9200
21、python- >>>fromdatetimeimportdatetime
复制代码 >>>fromelasticsearchimportElasticsearch
#bydefaultweconnecttolocalhost:9200
>>>es=Elasticsearch()
#createanindexinelasticsearch,ignorestatuscode400(indexalreadyexists)
>>>es.indices.create(index=my-index,ignore=400)
{uacknowledged:True}
#datetimeswillbeserialized
>>>es.index(index="my-index",doc_type="test-type",id=42,body={"any":"data","timestamp":datetime.now()})
{u_id:u42,u_index:umy-index,u_type:utest-type,u_version:1,uok:True}
#butnotdeserialized
>>>es.get(index="my-index",doc_type="test-type",id=42)[_source]
{uany:udata,utimestamp:u2013-05-12T19:45:31.804229}
欢迎大家来到仓酷云论坛! |
|