小编kev*_*vin的帖子

如何使用 Java API 使用 Elasticsearch FunctionScore 查询

我需要使用 Java API 实现以下 function_score 查询。我在elasticsearch的Java API部分找不到任何关于function_score查询的官方文档

{
  "size": 40,
  "query": {
    "function_score": {
      "functions": [
        {
          "gauss": {
            "location": {
              "origin": {
                "lat": 39.99606,
                "lon": 116.480484
              },
              "offset": "2km",
              "scale": "3km"
            }
          }
        }
      ],
      "score_mode": "sum",
      "boost_mode": "replace",
      "query": {
        "bool": {
          "must": [
            {
              "range": {
                "startTime": {
                  "from": "2016-04-12T12:00:00.000Z",
                  "to": "2016-04-12T16:00:00.000Z",
                  "include_lower": true,
                  "include_upper": true
                }
              }
            },
            {
              "range": {
                "endTime": {
                  "from": "2016-04-12T12:00:00.000Z",
                  "to": "2016-04-12T16:00:00.000Z",
                  "include_lower": true,
                  "include_upper": true
                }
              }
            }
          ]
        } …
Run Code Online (Sandbox Code Playgroud)

java elasticsearch

2
推荐指数
1
解决办法
4343
查看次数

标签 统计

elasticsearch ×1

java ×1