elasticsearch-analysis-pinyin
- 下载
git clone https://github.com/medcl/elasticsearch-analysis-pinyin 安装
mvn clean install -Dmaven.test.skip
or/home/xuliansheng/devspace/app/apache-maven-3.1.1/bin/mvn clean install -Dmaven.test.skip
- 拷贝到es_home/plugins/pinyin
cd target/releases/
cp elasticsearch-analysis-pinyin-5.4.2.zip /usr/share/elasticsearch/plugins/
cd /usr/share/elasticsearch/plugins/
unzip elasticsearch-analysis-pinyin-5.4.2.zip
service elasticsearch restart 添加JAVA_HOME目录
jre
长期生效export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) jdk: export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
vim /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_131
export PATH=$JAVA_HOME/bin:$PATH使用拼音搜索器创建索引
GET /mihuan_release/product_info/_search { "query": { "match": { "name.pinyin": "ty" } } }
- 参考:
https://github.com/medcl/elasticsearch-analysis-pinyin
https://travis-ci.org/medcl/elasticsearch-analysis-pinyin/builds/154192053
http://www.speedtest.cn/
php客户端调用es
php客户端调用es
1.在https://packagist.org/
搜索elasticsearch
2.通过composer安装:
composer require elasticsearch/elasticsearch安装composer参考:
http://docs.phpcomposer.com/01-basic-usage.html#Installation
3.配置_rg/res.yml
4.连接5.使用
class EsSvc extends Svc
{
public function testEs(){
$params = [
‘index’ => ‘wcloud’,
‘type’ => ‘1035346’,
‘id’ => ‘1498579190’
];
$response = Svc::getEsInstance()->get($params);
return $response;
}
}从索引(index)为wcloud、类型(type)为1035346中查找id为1498579190的一条记录
6.返回结果