es guass 案例

原创 2016年08月31日 15:26:16
_analyze?analyzer=standard



curl -XPOST http://192.168.1.47:9200/searchtube

"search_analyzer": "ik_max_word",
"analyzer": "ik_max_word"

curl -XPUT http://192.168.1.47:9200/searchtube/video/_mapping -d '{
  "video": {
    "properties": {
      "title": {
        "type": "string",
        "search_analyzer": "ik_max_word",
        "analyzer": "ik_max_word"
      },
      "description": {
        "type": "string",
        "search_analyzer": "ik_max_word",
        "analyzer": "ik_max_word"
      },
      "views": {
        "type": "integer"
      },
      "likes": {
        "type": "integer"
      },
      "created_at": {
        "type": "date",
        "format" : "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd"
      }
    }
  }
}'


curl -XPUT http://192.168.1.47:9200/searchtube/video/1 -d '{
  title: "pg.com",
  description: "pg.com",
  views: 500,
  likes:2,
  created_at: "2014/04/22 04:00:00"
}'


curl -XPUT http://192.168.1.47:9200/searchtube/video/2 -d '{
  title: "欧莱雅",
  description: "欧莱雅品牌",
  views: 6000,
  likes: 100,
  created_at: "2014/04/22 05:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/3 -d '{
  title: "bmw",
  description: "bmw",
  views: 100,
  likes: 130,
  created_at: "2014/04/22 06:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/8 -d '{
  title: "宝马",
  description: "bmw",
  views: 100,
  likes: 130,
  created_at: "2014/04/22 07:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/9 -d '{
  title: "宝马 x6",
  description: "bwm.com",
  views: 900,
  likes: 730,
  created_at: "2014/04/22 08:00:00"
}'
curl -XPUT http://192.168.1.47:9200/searchtube/video/10 -d '{
  title: "宝马 x10",
  description: "bwm.com bmw",
  views: 90,
  likes: 630,
  created_at: "2014/04/22 09:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/11 -d '{
  title: "宝马 x11",
  description: "bwm.com bmw",
  views: 200,
  likes: 530,
  created_at: "2014/04/22 10:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/4 -d '{
  title: "baidu",
  description: "baidu.com",
  views: 100,
  likes:2,
  created_at: "2014/04/22 09:00:00"
}'


curl -XPUT http://192.168.1.47:9200/searchtube/video/5 -d '{
  title: "宝洁",
  description: "pg.com",
  views: 300,
  likes:2,
  created_at: "2014/04/22 10:00:00"
}'


curl -XPUT http://192.168.1.47:9200/searchtube/video/6 -d '{
  title: "宝洁 广告",
  description: "pg.taobao.com",
  views: 300,
  likes:2,
  created_at: "2014/04/22 11:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/7 -d '{
  title: "天猫",
  description: "taoobao.com",
  views: 800,
  likes:2,
  created_at: "2014/04/22 13:00:00"
}'


curl -XPUT http://192.168.1.47:9200/searchtube/video/12 -d '{
  title: "宝马 x12",
  description: "bwm.com bmw",
  views: 200,
  likes: 530,
  created_at: "2014/04/23 10:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/13 -d '{
  title: "宝马 x13",
  description: "bwm",
  views: 200,
  likes: 530,
  created_at: "2014/04/24 10:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/14 -d '{
  title: "bmw",
  description: "bwm",
  views: 200,
  likes: 530,
  created_at: "2014/04/24 11:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/15 -d '{
  title: "bmw",
  description: "bwm",
  views: 200,
  likes: 530,
  created_at: "2014/04/24 12:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/16 -d '{
  title: "bmw 24",
  description: "bmw",
  views: 200,
  likes: 530,
  created_at: "2014/04/24 13:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/17 -d '{
  title: "bmw 25",
  description: "bmw",
  views: 200,
  likes: 530,
  created_at: "2014/04/24 14:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/18 -d '{
  title: "bmw 25",
  description: "bmw",
  views: 200,
  likes: 530,
  created_at: "2014/04/25 14:00:00"
}'

curl -XPUT http://192.168.1.47:9200/searchtube/video/19 -d '{
  title: "bmw 25",
  description: "bmw",
  views: 200,
  likes: 530,
  created_at: "2014/04/26 14:00:00"
}'


curl -XPUT http://192.168.1.47:9200/searchtube/video/20 -d '{
  title: "宝马 x12",
  description: "bwm.com bmw",
  views: 200,
  likes: 530,
  created_at: "2014/04/23 11:00:00"
}'


curl -XPUT http://192.168.1.47:9200/searchtube/video/21 -d '{
  title: "宝马 x12",
  description: "bwm.com bmw",
  views: 200,
  likes: 530,
  created_at: "2014/04/23 12:00:00"
}'



curl -XPUT http://192.168.1.47:9200/searchtube/video/22 -d '{
  title: "宝马 x12",
  description: "bwm.com bmw",
  views: 200,
  likes: 530,
  created_at: "2014/04/23 13:00:00"
}'


curl -XPOST http://192.168.1.47:9200/searchtube/_search -d '
{
  "query": {
    "function_score": {
      "query": {"match": {"_all": "severed"}},
      "script_score": {
        "script": "_score * log(doc['likes'].value + doc['views'].value + 1)"
      }
    }
  }
}'



curl -XPOST http://192.168.1.47:9200/searchtube/_search -d '
{
  "query": {
    "function_score": {
      "query": {"match": {"_all": "severed"}},
      "script_score": {
        "script": "_score * doc['views'].value + 1"
      }
    }
  }
}'



{
  "query": {
    "function_score": {
        "functions": [
          {
            "gauss": {
                "created_at": {
                    "origin": "2014-04-22T23:50:00",
                    "scale": "12h",
                    "offset": "1h",
                    "decay": 0.3
                }
            }
          },
          {
            "gauss": {
              "likes": {
                  "origin": 20000,
                  "scale": 20000
              }
            }
          },
          {
            "gauss": {
              "views": {
                  "origin": 20000,
                  "scale": 20000
              }
            }
          }
        ]
    }
  }
}



curl -XGET 'localhost:9200/hotels/_search/?pretty' -d'
{
  "query": {
    "function_score": {
      "functions": [
        {
          "gauss": {
            "price": {
              "origin": "0",
              "scale": "20"
            }
          }
        },
        {
          "gauss": {
            "location": {
              "origin": "11, 12",
              "scale": "2km"
            }
          }
        }
      ],
      "query": {
        "match": {
          "properties": "balcony"
        }
      },
      "score_mode": "multiply"
    }
  }
}'

版权声明:本文为博主原创文章,未经博主允许不得转载。

ElasticSearch学习二:构建集群与简单搜索实例应用

关于ElasticSearch不介绍了,直接说应用. 分布式ElasticSearch集群构建的方法. 1.通过在程序中创建一个嵌入es节点(Node),使之成为es集群的一部分,然后通过这个...
  • paul342
  • paul342
  • 2016年06月17日 10:30
  • 1323

ES多实例配置

配置变更http.port这个配置是elasticsearch对外提供服务的http端口配置,默认情况下ES会取用9200~9299之间的端口,如果9200被占用就会自动使用9201,在单机多实例的配...
  • Desilting
  • Desilting
  • 2017年03月01日 14:41
  • 564

ElasticSearch26:初识搜索引擎_用一个例子告诉你mapping到底是什么

1.准备数据PUT /website/article/1 { "post_date":"2018-01-01", "title":"my first article", "content"...
  • m0_37557582
  • m0_37557582
  • 2018年01月02日 14:56
  • 65

Java-随机数Random

Java-随机数RandomJava中存在着两种Random方法:一、Math.RandomMath.Random()方法能够返回带正号的double值,该值大于等于0.0且小于1.0,即取值范围为[...
  • jzp1083462154
  • jzp1083462154
  • 2018年01月18日 22:40
  • 26

es 基本语法 使用 案例

elasticsearch 语法汇总 使用 es 已有段时间 今天 有时间 就把最近使用用到的知识点 记录下来,以备后续使用 es 安装 和插件配置 等知识 这里就不在 累述 1 基本命令 使...
  • u014017121
  • u014017121
  • 2017年03月16日 12:36
  • 639

基于Calcite Elasticsearch实现的SQL ON ES方案设想

Elasticsearch是搜索的王者,其强大的DSL不让SQL,但缺少SQL的关键特性,如Join。ES的策略是紧紧拥抱Hadoop/Hive,Spark,有个ES-hadoop方案。Hadoop本...
  • china_world
  • china_world
  • 2016年04月13日 10:48
  • 3413

Guass模板

#include #include #include #include #include using namespace std; const int MAXN=50; int a[MAXN]...
  • u012432827
  • u012432827
  • 2015年04月29日 14:49
  • 100

es学习:基础知识介绍

一、概述 Elasticsearch:是一个开源的分布式搜索引擎服务器;有一下特点和功能: 1.      支持分布式存储; 2.      提供全文检索功能; 3.      完成对大数据的...
  • u011066470
  • u011066470
  • 2016年07月02日 17:30
  • 1373

POJ 2345 Central heating 高斯消元

n个人n个开关,每个人可以开或者关一些开关,选出一部分人,使得所有的开关都是开的。 package fd; import java.util.Scanner; public class ...
  • u011686226
  • u011686226
  • 2016年07月18日 09:03
  • 348

有限元笔记1-高斯积分

欢迎使用Markdown编辑器写博客在有限元计算中,积分运算是非常重要的一种运算,比如刚度矩阵的运算(以二维问题为例): [K]=∫∫A[B]T[D][B]hdxdy \left[ K \right...
  • walkandthink
  • walkandthink
  • 2016年04月30日 02:28
  • 3582
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:es guass 案例
举报原因:
原因补充:

(最多只允许输入30个字)