我有以下Elasticsearch映射:
"show": {
"properties": {
"startsAt": {
"type": "date"
},
"venue": {
"type": "nested",
"properties": {
"name": {
"type": "string"
},
"address": {
"type": "string",
"index": "no"
},
"location": {
"type": "geo_point",
"lat_lon": true
},
"section": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
我希望使用show.startsAt
,show.venue.location
和show.venue.section
属性找到完全匹配。我一直在尝试以下查询,但它没有考虑show.venue.section
。
bool: {
must: [
{match: {startsAt: starts}},
{
nested: {
path: 'venue',
query: {
match: {'venue.section': section}
},
filter: {
geo_distance: {
distance: '1m',
'venue.location': location
}
}
}
}
]
}
答案 0 :(得分:0)
此查询对我有用:
query: {
bool: {
must: [
{match: {startsAt: starts}},
{
nested: {
path: 'venue',
filter: {
bool: {
must: [
{
geo_distance: {
distance: '1m',
'venue.location': location
}
},
{
term: {'venue.section': section}
}
]
}
}
}
}
]
}
}