我正在编写一个搜索查询,要求我访问出发对象“ city”的属性
public List<Map<String, Object>> ff(int minPrice, int maxPrice, String city) {
List<Map<String, Object>> search = new ArrayList<>();
QueryBuilder range = QueryBuilders.rangeQuery("price")
.from(minPrice)
.to(maxPrice)
.includeLower(true)
.includeUpper(true);
QueryBuilder cityQuery = QueryBuilders.matchQuery("departure.city", city);
QueryBuilder query = QueryBuilders.boolQuery()
.filter(range)
.filter(cityQuery);
当我尝试为我肯定存在于数据中的城市进行数据查询时,我会得到空结果
下面是我的索引
{
"tourdata": {
"aliases": {},
"mappings": {
"tours": {
"properties": {
"departure": {
"properties": {
"city": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"date": {
"type": "date"
}
}
},