我的文件如下:
{
"_index": "abc_local",
"_type": "users",
"_id": "1",
"_version": 5,
"found": true,
"_source": {
"firstname": "simer",
"lastname": "kaur",
"gender": "1",
"Address": "Punjab House Fed. Housing Society, Amritsar, Punjab, India",
"email": "rav@yopmail.com",
"occupation": "Php Developer",
"work": "Development",
"fav_hunting_land": 2,
"zipcode": "",
"marital_status": "1",
"phone": "1234567899",
"school": "sdfergdfh",
"species": [{
"id": 1
}, {
"id": 2
}, {
"id": 3
}, {
"id": 4
}, {
"id": 5
}, {
"id": 6
}],
"activities": [{
"id": 1
}],
"fav_weapon": 6,
"weapons": [{ …Run Code Online (Sandbox Code Playgroud) 我必须对使用弹性 Java 高级其余客户端 api 嵌套的一级字段进行排序。我可以找到这个答案
问题是答案使用 SortBuilder 使用以下代码对嵌套字段进行排序:
SortBuilder sb = SortBuilders.fieldSort("authorList.lastName")
.order(SortOrder.ASC)
.setNestedPath("authorList")
.setNestedFilter(matchFirst);
Run Code Online (Sandbox Code Playgroud)
然而,似乎nestedPath 和NestedFilter 在6.3.2 elastic(deprication info)中已被弃用,并且引入了新的NestedSortBuilder。但是我无法使用它构建查询。任何人都可以解释如何使用它,或者给我指出一个使用它的例子吗?
我想查询已加载到 Elasticsearch 5 中的嵌套数据,但每个查询都没有返回任何内容。数据是对象数据类型和json 嵌套数组。
这是嵌套数据类型,即 json 的 team_members 数组:
[{
"id": 6,
"name": "mike",
"priority": 1
}, {
"id": 7,
"name": "james",
"priority": 2
}]
Run Code Online (Sandbox Code Playgroud)
该对象数据类型即availability_slot json:
{
"monday": {
"on": true,
"end_time": "15",
"start_time": "9",
"end_time_unit": "pm",
"start_time_unit": "am",
"events_starts_every": 10
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的弹性搜索映射:
{
"meetings_development_20170716013030509": {
"mappings": {
"meeting": {
"properties": {
"account": {"type": "integer"},
"availability_slot": {
"properties": {
"monday": {
"properties": {
"end_time": {"type": "text"},
"end_time_unit": {"type": "text"},
"events_starts_every": {
"type":"integer"
}, …Run Code Online (Sandbox Code Playgroud) elasticsearch elasticsearch-query elasticsearch-nested elasticsearch-5