标签:uil dynamic 准备 删除索引 rac http color oracle org
tar vxf elasticsearch-2.3.4.tar
./bin/elasticsearch
./bin/elasticsearch -d
curl -XGET "http://127.0.0.1:9200/?pretty"
{ "name": "Nico Minoru", "cluster_name": "elasticsearch", "version": { "number": "2.3.4", "build_hash": "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f", "build_timestamp": "2016-06-30T11:24:31Z", "build_snapshot": false, "lucene_version": "5.5.0" }, "tagline": "You Know, for Search" }
#删除索引 curl -XDELETE ‘http://127.0.0.1:9200/gsdata‘ #创建Mapping curl -XPUT "http://127.0.0.1:9200/gsdata" -d‘ { "mappings":{ "egov_basc_jbxx":{ "_all": { "analyzer": "ik_max_word", "search_analyzer": "ik_max_word", "term_vector": "no", "store": "false" }, "dynamic":false, "properties": { "id":{ "type":"string" }, "entname":{ "type":"string", "analyzer":"ik_smart" }, "lerep":{ "type":"string", "analyzer":"ik_max_word" }, "poscope":{ "type":"string", "analyzer":"ik_smart" }, "econat":{ "type":"string", "analyzer":"ik_smart" }, "esdate":{ "type":"date" }, "regcap":{ "type":"integer" }, "state":{ "type":"string" } } } } }‘ #同步数据 DIR=/home/search/elasticsearch-jdbc-2.3.4.0 bin=${DIR}/bin lib=${DIR}/lib JAVA_HOME=/home/search/jdk1.8.0_111 echo ‘ { "type" : "jdbc", "jdbc" : { "url" : "jdbc:oracle:thin:@//127.0.0.1:1521/ORCL", "user" : "intgdata", "password" : "intgdata", "sql" : "SELECT ID as \"id\" , ENTNAME as \"entname\" , LEREP as \"lerep\", OPSCOPE as \"poscope\", ECONAT as \"econat\", ESTDATE as \"esdate\" ,REGCAP as \"regcap\" ,STATE as \"state\" FROM EGOV_BASC_JBXX ", "treat_binary_as_string" : true, "index" : "gsdata", "type": "egov_basc_jbxx", "elasticsearch" : { "cluster" : "elasticsearch", "host" : "127.0.0.1", "port" : 9300 } } } ‘ | ${JAVA_HOME}/bin/java \ -cp "${lib}/*" -Dlog4j.configurationFile=${bin}/log4j2.xml org.xbib.tools.Runner org.xbib.tools.JDBCImporter
备注:因为这个版本elasticsearch-jdbc必须要1.8以上的版本,所以可以指定jdk去运行
curl -XPOST ‘http://localhost:9200/_search‘
Linux上搭建Elasticsearch服务器并同步数据库
标签:uil dynamic 准备 删除索引 rac http color oracle org
原文地址:http://www.cnblogs.com/xugongkai/p/6065136.html