首页 > 技术文章 > Elasticsearch 文档专用

shoutn 2017-12-14 11:44 原文


ES安装等操作

http://blog.csdn.net/cnweike/article/details/33736429

https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html

http://blog.csdn.net/sinat_28224453/article/details/51134978

http://blog.csdn.net/peibolinux/article/details/37560657

 

./elasticsearch --cluster.name xiaotian --node.name xiaotian_node

 

useradd es -g es -p es
chown -R es:es elasticsearch-6.0.6


es安装问题总结:
http://blog.csdn.net/wang_zhenwei/article/details/53785048


curl -XPUT -u elastic 'http://http://192.168.22.143:9200/_xpack/security/user/elastic/_password' -H 'Content-Type: application/json' -d '{"password" : "123"}'

########################################

Changed password for user kibana
PASSWORD kibana = xTkp&ONvKAo5!r4OB770

Changed password for user logstash_system
PASSWORD logstash_system = @fI4nPRVokNbvTZ1P_ti

Changed password for user elastic
PASSWORD elastic = F~~aA%DgJcXLK5lKXNU9

 

http://192.168.22.143:5601/

curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '{"name": "John Doe"}'


curl -XPUT 'http://192.168.22.139:9200/customer/external/1?pretty' -d '{"name": "John Doe"}'


curl -XPUT 'http://127.0.0.1:9200/custo/user22/1?pretty' -H 'Content-Type: application/json' -d '{"name":"John Doe"}'
http://man.linuxde.net/curl

kibana安装
http://blog.csdn.net/jklfjsdj79hiofo/article/details/72355167


curl -XPUT 'http://192.168.22.143:9200/custo/user/?pretty' -H 'Content-Type: application/json' -d '{"id":"3","name":"jim","age":"12","tel":"18612855318"}'

curl -XPOST 'http://192.168.22.143:9200/red89/_setting'

 

//查询
http://blog.csdn.net/asia_kobe/article/details/51377631

https://www.cnblogs.com/jasonduan/p/4387156.html

 

 

https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/_maven_repository.html

 

###################################设置mapping######################################################

curl -XPUT http://192.168.22.143:9200/red88/ -H 'Content-Type: application/json' -d '{
"mappings" : {
"test" : {
"properties" : {
"attr_name" : { "type":"keyword" }
}
}
}
}'

 

curl -XDELETE http://192.168.22.143:9200/red33/ -H 'Content-Type: application/json' -d '{
"mappings" : {
"test" : {
"properties" : {
"attr_name" : { "index":"not_analyzed" }
}
}
}
}'


curl -XPUT http://192.168.22.143:9200/red88/_mapping/test -H 'Content-Type: application/json' -d '{
"properties": {
"attr_name": {
"type":"string",
"index": "not_analyzed",
"fielddata": true
}
}
}'

curl -XPOST 'http://192.168.22.143:9200/red1/test'


curl -XPUT 'http://192.168.22.143:9200/red1'


curl -XPUT http://192.168.22.143:9200/temp/_mapping/test -H 'Content-Type: application/json' -d
'{
"test": {
properties: {
"attr_name": {"type":"string", "index": "not_analyzed"}
}
}
}'

 

PUT -XPUT http://192.168.22.143:9200/twitter -H 'Content-Type: application/json' -d
'{
"mappings": {
"tweet": {
"properties": {
"age": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
}'

 


curl -XPUT http://192.168.22.143:9200/twitter/_mapping/tweet -H 'Content-Type: application/json' -d '{
"mappings": {
"type": {
"properties": {
"publisher": {
"type": "text",
"fielddata": true }
}
}
}
}
}'

PUT twitter
{
"mappings": {
"tweet": {
"properties": {
"age": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
}

添加数据的例子

http://localhost:8081/bulkP?index=red88&type=test&id=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20

http://localhost:8081/searchFilter

打分例子
https://www.programcreek.com/java-api-examples/index.php?api=org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html
http://www.massapi.com/source/github/92/86/928610678/src/test/java/org/elasticsearch/benchmark/scripts/score/BasicScriptBenchmark.java.html#306
https://www.elastic.co/guide/cn/elasticsearch/guide/current/script-score.html


es插件:
https://github.com/medcl/elasticsearch-rtf


es filter 过滤参数

https://stackoverflow.com/questions/34095042/elasticsearch-issue-with-aggregations-along-with-filters
http://teknosrc.com/elasticsearch-use-script-filter-conditon-aggregation-sub-aggreagtion/
http://blog.csdn.net/molong1208/article/details/50589469
http://www.th7.cn/Program/java/201704/1154869.shtml
http://blog.csdn.net/dm_vincent/article/details/42757519
http://cwiki.apachecn.org/display/Elasticsearch/Filters+Aggregation


安装IK分词
https://github.com/medcl/elasticsearch-analysis-ik

 


curl -XPOST 'http://192.168.22.143:9200/red89/_analyze?pretty' -H 'Content-Type: application/json' -d '
{
"analyzer":"ik_max_word",
"text":"中华人民共和国国歌"
}'

Painless 语言实现打分 ********************
https://www.compose.com/articles/how-to-script-painless-ly-in-elasticsearch/

 

推荐阅读