Quantcast
Channel: 钻戒 and 仁豆米
Viewing all articles
Browse latest Browse all 290

申请一个免费的elasticsearch服务器

$
0
0

https://bonsai.io

在上面的网址就可以免费注册一个elasticsearch的服务器。

注册过程就不多说了。

注册后建立一个cluster:

点击集群进去,打开Interactive console:

首先我们必须创建一个index

POST /movies
这样就建立好了一个movies的index

然后弄点数据进去

PUT /movies/movie/1  
{
    "title": "The Godfather",
    "director": "Francis Ford Coppola",
    "year": 1972
}

这样就好了。 修改一下mapping

PUT /movies/movie/_mapping  
{
   "movie": {
      "properties": {
         "director": {
            "type": "multi_field",
            "fields": {
                "director": {"type": "string"},
                "original": {"type" : "string", "index" : "not_analyzed"}
            }
         }
      }
   }
}

然后重新提交一下数据,便于索引更新

再查一下:

POST /_search  
{
    "query": {
        "constant_score": {
            "filter": {
                "term": { "director.original": "Francis Ford Coppola" }
            }
        }
    }
}

ok了,这个免费的服务器,大家可以用来给自己的博客或者爬虫用,呵呵。


Viewing all articles
Browse latest Browse all 290

Trending Articles