- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个名为“posts”的elasticsearch索引。http://127.0.0.1:9200/posts/doc/_count
返回{"count":240000,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0}}
。
我正在尝试在“doc”类型中找到最低ID字段。谷歌搜索后,我相信我想要的工具是聚合。
大部分直接从official documentation复制和粘贴后,我开始使用它:
POST /posts/_search?size=0
{
"aggs" : {
"min_id" : { "min" : { "field" : "id" } }
}
}
curl -X POST "localhost:9200/posts/_search?size=0" -H 'Content-Type: application/json' -d'{"aggs" : {"min_id" : { "min" : { "field" : "id" } }}}'
提交请求。
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 240000,
"max_score" : 0.0,
"hits" : [ ]
},
"aggregations" : {
"min_id" : {
"value" : null
}
}
}
min_id
的值不应为null。
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 240000,
"max_score" : 1.0,
"hits" : [
{
"_index" : "posts",
"_type" : "doc",
"_id" : "1733768",
"_score" : 1.0,
"_source" : {
"doc" : {
"id" : 1733768,
"description" : "",
"ext" : "png",
"tags" : [],
...
}
}
}
]
},
"aggregations" : {
"min_id" : {
"value" : null
}
}
}
最佳答案
差不多了,您犯了一个小错误,id
字段位于doc
对象结构内部,因此您需要查询doc.id
而不是id
,如下所示:
POST /posts/_search?size=0
{
"aggs" : {
"min_id" : { "min" : { "field" : "doc.id" } }
^
|
add this
}
}
关于elasticsearch - Elasticsearch Minimum Aggreviate返回null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53905189/
我是 Haskell 术语的初学者。我必须做一个显示所有最低位置的练习。 例如: [1,2,3,1,1] => 0,3,4 这些是最小位置。 我尝试用两种方法来做到这一点,但这些都不起作用。 请有人帮
我需要找到整个矩阵的最小值,它是“坐标”。在像 这样的矩阵中 matrix = 8 7 6 5 4 3 2 1 最小值为 (2, 4) 处的 1。 最佳答案 这可以很简单地通过使用
给定一个正整数“l”和“r”。找到最小的数字“n”,使得 l r: cnt = 32 for i in range(l, r+1): s = bi
numpy.minimum 似乎不适用于复数: np.minimum(5+3*1j,4+30*1j) (4+30j) 我想保持最大幅度的值。它只比较实部。元素最小比较的任何其他功能? MATLAB m
鉴于数据库中的以下事实: foo(a, 3). foo(b, 2). foo(c, 4). foo(d, 3). foo(e, 2). foo(f, 6). foo(g, 3). foo(h, 2).
假设我们给出了给定图 G 的最小生成树 T(有 n 个顶点和 m 个边)和一条权重为 w 的新边 e = (u, v),我们将添加到 G 中。 I) 检查 T 是否仍然是 MST。II) 如果不是,请
我有一个名为“posts”的elasticsearch索引。 http://127.0.0.1:9200/posts/doc/_count返回{"count":240000,"_shards":{"t
我在 MySQL 中有一个表,名称如下 我有两件事要处理 1- 停用所有未使用的书籍 isActive = 1 - Active isActive = 0 - Inactive is_inuse =
我的站点位于 www.ethoma.com/wd/ . 如您所见,我已经使用自己的代码实现了主题和所有菜单。我想在我的网站上安装 WordPress,这样我就可以简单地在 WordPress 上输入我
当我在 bool 数组上使用 numpy 函数 minimum() 和 maximum() 时,结果类型打印为 numpy.int32。但是,与 numpy.int32 类型的比较失败(即使在转换之后
我在分布式系统中遇到分片移动问题。 【问题】 最初每个分区负责任意数量的分片。 (这个数字可以是任意的,因为系统支持将分片从一个分区移动到另一个分区) 然后一个新的分区来了,系统需要重新分片。目标是使
我有 3 个这样的观点: 我需要定义一个约束,以便在蓝色或芥末色垂直调整大小时,红色 View 将保持在任一上 View 的最小距离处,例如 或者 那么我怎样才能达到那个结果呢??? 最佳答案 建立从
题目地址:https://leetcode.com/problems/minimum-area-rectangle/description/ 题目描述 Given a set of points
题目地址:https://leetcode-cn.com/problems/path-with-minimum-effort/ 题目描述 你准备参加一场远足活动。给你一个二维 rows x col
题目地址:https://leetcode.com/problems/minimum-absolute-difference/ 题目描述 Given an array of distinct in
题目地址:https://leetcode.com/problems/minimum-height-trees/description/ 题目描述 Fora undirected graph wi
题目地址:https://leetcode.com/problems/minimum-time-difference/description/ 题目描述: Given a list of 24-h
题目地址: https://leetcode.com/problems/minimum-genetic-mutation/description/ 题目描述 Agene string can be
你们能帮我解决一些我被困的家庭作业问题吗? 完整二叉树中的局部最小值被定义为小于其所有邻居(邻居 = 父、左子、右子)的节点。 我需要在给定的完整二叉树中找到一个局部最小值,它的每个节点都有不同的数字
(defun *smaller* (x y) ( if (> x y) y x)) (defun *minimum* (lst) (do ((numbers lst (cdr
我是一名优秀的程序员,十分优秀!