分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
[Elasticsearch6.X相关核心知识点必知必会](http://elasticsearch-cheatsheet.jolicode.com/
Elasticsearch5.X相关核心知识点必知必会(如下)。
首先,不要再使用curl,请安装sense(kibana5.x中默认包含sense)
1)ES官方向导
https://www.elastic.co/guide/en/elasticsearch/guide/master/index.html
2)ES官方文档(API相关)
https://www.elastic.co/guide/en/elasticsearch/reference/master/index.html
3)ES资源清单(全)
https://github.com/dzharii/awesome-elasticsearch
4)ES云
https://www.found.no/play
5)ES官方论坛(英文)
https://discuss.elastic.co/
6)ES|stackOverflow论坛地址
https://stackoverflow.com/questions/tagged/elasticsearch
7)ES 性能测试相关(NB)
https://www.datadoghq.com/blog/monitor-elasticsearch-performance-metrics/
基本查询有两种语法:左边是一个简单的语法,你不能使用任何选项,
右边是一个扩展。 大多数初学者头痛的DSL来自于:
GET _search{ "query": { "match": { "FIELD": "TEXT" } }}GET _search{ "query": { "match": { "FIELD": { "query": "TEXT", "OPTION": "VALUE" } } }}
GET /_search{ "query": { "bool": { "must": [ { "match": { "title": "smith" } } ], "must_not": [ { "match_phrase": { "title": "granny smith" } } ], "filter": [ { "exists": { "field": "title" } } ] } }, "aggs": { "my_agg": { "terms": { "field": "user", "size": 10 } } }, "highlight": { "pre_tags": [ "" ], "post_tags": [ "" ], "fields": { "body": { "number_of_fragments": 1, "fragment_size": 20 }, "title": {} } }, "size": 20, "from": 100, "_source": [ "title", "id" ], "sort": [ { "_id": { "order": "desc" } } ]}
多字段检索
"multi_match": { "query": "Elastic", "fields": ["user.*", "title^3"], "type": "best_fields"}
bool检索
"bool": { "must": [], "must_not": [], "filter": [], "should": [], "minimum_should_match" : 1}
范围检索
"range": { "age": { "gte": 10, "lte": 20, "boost": 2 }}
GET /_search?q=pony
GET /_search?q=title:(joli OR code) AND author:"Damien Alexandre"^2
GET /_search?q=_exists_:title OR title:singl? noneOrAnyChar*cter
GET /_search?q=title:elastichurch~3 AND date:[2016-01-01 TO 2018-12-31]
GET /_search{ "query": { "query_string": { "default_field": "content", "query": "elastic AND (title:lucene OR title:solr)" } }}
PUT /my_index_name{ "settings": { "number_of_replicas": 1, "number_of_shards": 3, "analysis": {}, "refresh_interval": "1s" }, "mappings": { "my_type_name": { "properties": { "title": { "type": "text", "analyzer": "english" } } } }}
PUT /my_index_name/_settings{ "index": { "refresh_interval": "-1", "number_of_replicas": 0 }}
PUT /my_index_name/_mapping/my_type_name{ "my_type_name": { "properties": { "tag": { "type": "keyword" } } }}
GET /my_index_name/_mappingGET /my_index_name/_settings
POST /my_index_name/my_type_name{ "title": "Elastic is funny", "tag": [ "lucene" ]}
PUT /my_index_name/my_type_name/12abc{ "title": "Elastic is funny", "tag": [ "lucene" ]}
DELETE /my_index_name/my_type_name/12abc
POST /my_index_name/_closePOST /my_index_name/_open
POST /_aliases{ "actions": [ { "remove": { "index": "my_index_name", "alias": "foo" } }, { "add": { "index": "my_index_name", "alias": "bar", "filter" : { "term" : { "user" : "damien" } } } } ]}
GET /_aliasesGET /my_index_name/_alias/*GET /*/_alias/*GET /*/_alias/foo
GET /my_index_name/_statsGET /my_index_name/_segmentsGET /my_index_name/_recovery?pretty&human
POST /my_index_name/_cache/clearPOST /my_index_name/_refreshPOST /my_index_name/_flushPOST /my_index_name/_forcemergePOST /my_index_name/_upgradeGET /my_index_name/_upgrade?pretty&human
GET /blog/post/_validate/query?explain{ "query": { "match": { "title": "Smith" } }}
GET /blog/post/1/_explain{ "query": { "match": { "title": "Smith" } }}
GET /blog/_analyze?field=title&text=powerful
GET /_analyze?analyzer=english&text=powerful
GET /_cluster/health?prettyGET /_cluster/health?wait_for_status=yellow&timeout=50sGET /_cluster/stateGET /_cluster/stats?human&prettyGET /_cluster/pending_tasksGET /_nodesGET /_nodes/statsGET /_nodes/nodeId1,nodeId2/stats
索引1的分片移动到索引2
POST /_cluster/reroute{ "commands": [ { "move": { "index": "my_index_name", "shard": 0, "from_node": "node1", "to_node": "node2" } }, { "allocate": { "index": "my_index_name", "shard": 1, "node": "node3" } } ]}
动态更新最小节点数。
PUT /_cluster/settings{ "persistent": { "discovery.zen.minimum_master_nodes": 3 }}PUT /_cluster/settings{ "transient": { "discovery.zen.minimum_master_nodes": 2 }}
使分片失效,在rolling重启前有效。
PUT /_cluster/settings{ "transient" : { "cluster.routing.allocation.enable" : "none" }}PUT /_cluster/settings{ "transient" : { "cluster.routing.allocation.enable" : "all" }}
ES5.X版本已不再支持站点插件,请查看kibana应用或类似Cerebro等其他独立的app做管理。
Cerebro地址: https://github.com/lmenezes/cerebro
Analysis ICU
从Unicode ICU库中添加有用的tokenizer和令牌过滤器。
bin/elasticsearch-plugin install analysis-icu
AWS Cloud
允许在Amazon云(EC2和S3)中发现和存储。
bin / elasticsearch-plugin install discovery-ec2 bin / elasticsearch-plugin install repository-s3
Azure Cloud
允许在微软云(EC2和S3)中发现和存储。
bin/elasticsearch-plugin install discovery-azure-classicbin/elasticsearch-plugin install repository-azure
插件管理:
bin/elasticsearch-plugin install file:///path/to/pluginbin/elasticsearch-plugin listbin/elasticsearch-plugin remove [pluginname]
RPM: /usr/share/elasticsearch/binDebian: /usr/share/elasticsearch/bin
Kibana: http://localhost:5601/.Elasticsearch: http://localhost:9200/.
单一Elasticsearch 服务器最大可用内存小于总内存的50%,且小于32GB;
假定你使用Ubuntu/Debian 服务器,你可以通过如下配置修改:
/etc/security/limits.confelasticsearch - nofile 65535elasticsearch - memlock unlimited
对于Centos服务器,修改配置如下:
/etc/default/elasticsearch (on CentOS/RH: /etc/sysconfig/elasticsearch)ES_HEAP_SIZE=20gMAX_OPEN_FILES=65535MAX_LOCKED_MEMORY=unlimited
cluster.name: joliclusternode.name: ${HOSTNAME}discovery.zen.ping.unicast.hosts: ["front01", "front02"]discovery.zen.minimum_master_nodes: 2network.host: _site_network.bind_host: [_site_, _local_]plugin.mandatory: analysis-icunode.data: truenode.master: truebootstrap.memory_lock: trueaction.auto_create_index: +aaa*,-bbb*,+ccc*,-*
本文是翻译的 http://elasticsearch-cheatsheet.jolicode.com/#es5。
Cheat sheet是作弊表的意思。可见源作者对文章寄托的意义就是最核心、最关键的ES知识点“小抄”。
我把它理解成ES学习中待翻看的字典。
尤其第0章节的相关链接,都是上乘ES佳作,待进一步深度剖析。
——————————————————————————————————
更多ES相关实战干货经验分享,请扫描下方【铭毅天下】微信公众号二维码关注。
(每周至少更新一篇!)
和你一起,死磕Elasticsearch!
——————————————————————————————————
2017年08月19日 14:45 于家中床前
作者:铭毅天下
转载请标明出处,原文地址:
http://blog.csdn.net/laoyang360/article/details/75094457
如果感觉本文对您有帮助,请点击‘顶’支持一下,您的支持是我坚持写作最大的动力,谢谢!