我在Elasticsearch(下面)中有一个复杂的查询,我需要在“Activité”(活动)桶中按date_creation升序排序。查询有效,但我对date_creation的基本排序却没有。我正在寻找如何按date_creation按升序排序活动。我已经在嵌套查询here on stackoverflow上看过一些帖子,例如here in the elastic search documentation,但他们似乎没有回答如何解决我的查询的复杂性。
我正在使用ElasticSearch 2.3.5和Lucene 5.5.0。
df.assign(**dict(zip(('Type', 'Parameter'), zip(*df.variable.str.split('_')))))
BatchNumber PhaseNumber SiteID variable Values Type Parameter
0 4552694035 0020B 2 min_tempC 27.0 min tempC
1 4552694035 OverAll 2 max_tempF 24.0 max tempF
答案 0 :(得分:1)
你可以这样做:
Activité: {
terms: {
field: "id_activite",
size: 10
},
aggs: {
"Titre activité": {
top_hits: {
_source: {
include: [
"titre_activite",
"nombre_perimetre_occurrence"
]
},
size: 1,
add this line -> sort: [{ date_creation: { order: "asc", mode: "min" } }],
}
},