30天了解30种技术系列---(10)面向Cloud的搜索引擎 ElasticSearch

什么是Lucene

 

Lucene是apache软件基金会4 jakarta项目组的一个子项目,是一个开放源代码的全文检索引擎工具包,即它不是一个完整的全文检索引擎,而是一个全文检索引擎的架构,提供了完整的查询引擎和索引引擎

 

基本上绝大多数的企业搜索框架目前都是集中使用Lucene。

 

什么是ElasticSearch

 

ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口.

ES的好处在于,本身就是为云及分布式设计,所以整体比较优化。

 

ElasticSearch 架构(来自兄弟Medcl)

 

 

ElasticSearch基本操作

 

#创建索引
$ curl -XPUT http://localhost:9200/test-index

#创建Mapping
$ curl -XPUT http://localhost:9200/test-index/test-type/_mapping -d '{
  "properties" : {
      "name" : { "type" : "string" }
  }
}'


#索引
$ curl -XPUT http://localhost:9200/test-index/test-type/1 -d '{
  "user": "jack",
  "post_date": "2015-11-15 13:12:00",
  "message": "Trying out elasticsearch, so far so good?"
}'

#获取
$ curl -XGET http://localhost:9200/test-index/test-type/1

#删除
$ curl -XDELETE 'http://localhost:9200/test-index/test-type/1'

 

ES本身也提供非常丰富的集群部署及相关的软件,大家可以进一步去获取相关的资源进行学习。

 

另外也重磅介绍ES中文社区http://elasticsearch.cn/?/explore/

社区的建设者Medcl是我们非常好的朋友,一起合作了很多事情。

 

更多精彩内容请关注

订阅号:图灵搜索,一个只为程序员的知识库服务,另外请大家使用https://www.tulingss.com 一个程序的搜索服务

 

 

猜你喜欢

转载自tulingss.iteye.com/blog/2233644