私信  •  关注

Wijayanga Wijekoon

Wijayanga Wijekoon 最近回复了
6 年前
回复了 Wijayanga Wijekoon 创建的主题 » 表错误中的MySQL自动增量键

删除行后使用此查询,

实际上,这就是MySQL的工作原理,这不是一个错误

6 年前
回复了 Wijayanga Wijekoon 创建的主题 » Elasticsearch按自定义项权重排序
Here's the code sample of sorting result. I think this will helps you. If you don't want to get entire documents as result you can filter results using includes. 

GET testindex/_search
{
  "_source": {
"includes": [
  "filed1"
]
},
  "aggs": {
    "emp_figures": {
      "terms": {
        "field": "status"
      }
    }
}
}

This is the sample result you should retrieve 
{
  "took": 11,
  "timed_out": false,
  "_shards": {
    "total": 2,
    "successful": 2,
    "failed": 0
  },
  "hits": {
    "total": 84968,
    "max_score": 1,
    "hits": [
      {
        "_index": "test",
        "_type": "type",
        "_id": "0001",
        "_score": 1,
        "_source": {
          "filed1": "color1,
          }
        },
         {
        "_index": "test",
        "_type": "type",
        "_id": "0002",
        "_score": 1,
        "_source": {
          "filed1": "color2,
          }
        }
      }
    }
}