ElasticSearch 攻略(一) 小咪咪 2022-07-24 05:15 145阅读 0赞 ElasticSearch(下简称 es)一句话简介:Java、NoSQL、based on Lucene、Key-Value & Documented Store、JSON API、borned for FAST INDEX & Search、分布式/副本集/负载均衡/容灾等。 Why es? > *大家知道用like搜索的性能是何其低下,尤其是当关键词前也要加%匹配的时候,即使建立了索引,也要进行全表扫描。* > > *当这种搜索的请求比较频繁的时候,数据库就会成为性能瓶颈。 我们熟知的Lucene是一款非常优秀的开源搜索引擎,不过它的使用比较复杂,产生的大量索引文件也不便于管理。* > > *这时不妨试试elasticsearch,它不仅基于lucene,拥有和lucene一样强大的搜索功能,而且为索引文件提供了分布式管理平台,而且大大简化了搜索相关的API。[<出处>][Link 1]* Why not just Lucene?----首先两者定位不一样,然后 es 屏蔽了 Lucene 的复杂却发挥了 Lucene 的强大。es 可实现搜索集群。 ### 下载、安装、启动 ### 学习资源:免费电子书[《Elasticsearch 权威指南》][Elasticsearch]已汉化,[中文网][Link 2],Elasticsearch: [The Definitive Guide][],Elasticsearch [Reference][],官方原生[ Java API 说明][Java API]。 当前最新版本是 Elasticsearch 2.3.2。官网下载 [https://www.elastic.co/downloads/elasticsearch][https_www.elastic.co_downloads_elasticsearch] ![SouthEast][] Window 平台下载 zip 包,解压缩,进入 bin 目录执行 elasticsearch.bat 启动 es 后台服务, ![SouthEast 1][] 显示一些启动信息,表示 es 启动成功,然后再浏览器中输入地址 http://localhost:9200,可以看到 es 版本等的信息。 ![SouthEast 2][] 更加印证了 es 启动成功。es 返回的是 JSON。如果你的浏览器装有 JSON 美化插件,是能够像我那些格式化显示的。 接着我们安装一下 head 插件,是 es 的 Web 管理界面。 同样在 bin 目录下,输入, plugin install mobz/elasticsearch-head 如果安装错误,请把 plugin-install 之间的横杠去掉“-”。 安装后要重启的 es,然后在浏览器中输入 [http://localhost:9200/\_plugin/head/][http_localhost_9200_plugin_head],显示如下。 ![20160514111317209][] 至此,我们的 es 工作良好。暂时我们休息一会儿,回头再来看。 [Link 1]: http://minirick.duapp.com/yong-elasticsearchwei-ni-de-xiang-mu-ti-gong-chui-zhi-sou-suo-fu-wu/?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io [Elasticsearch]: http://www.learnes.net/index.html [Link 2]: http://elasticsearch.cn/ [The Definitive Guide]: https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html [Reference]: https://www.elastic.co/guide/en/elasticsearch/reference/2.3/index.html [Java API]: https://www.elastic.co/guide/en/elasticsearch/client/java-api/2.3/index.html [https_www.elastic.co_downloads_elasticsearch]: https://www.elastic.co/downloads/elasticsearch [SouthEast]: /images/20220722/f9dd4192476c4d44a6c9a3466b2f1a76.png [SouthEast 1]: /images/20220722/ab88772a804947c3b1950737a33fcc16.png [SouthEast 2]: /images/20220722/cbff32c336af4fbf965f29c0075a66ea.png [http_localhost_9200_plugin_head]: http://localhost:9200/_plugin/head/ [20160514111317209]: /images/20220722/f4343f6b37e6464a92bd1343c38c5484.png
还没有评论,来说两句吧...