栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何只检索匹配的子?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何只检索匹配的子?

这是解决我的问题的可行方法,也许对某人有用。

位置映射:

{    "location" : {        "properties": { "name": { "type": "string", "boost": 2.0, "analyzer": "snowball" }, "description": { "type": "string", "analyzer": "snowball" }, "geo": { "type": "geo_point" }        }    }}

展品图:

{    "exhibit": {        "_parent": { "type": "locations" },        "properties": { "name": { "type": "string", "boost": 2.0, "analyzer": "snowball" }, "description": { "type": "string", "analyzer": "snowball" }        }    }}

查询:

{    "fields": [ "_parent", "name", "_source" ],    "query": {        "bool": { "should": [      { "text": { "name": "candy" } },     { "text": { "description": "candy" } }  ]        }    },    "filter": {         "and": [ {     "terms" : {         "_parent": [ "4e7089a9b97d640b30695b7a", "4e7089eeb97d640b30695b7b" ]     } }, { "range": { "start": { "lte": "2011-09-22" } } }, { "range": { "end": { "gte": "2011-09-22" } } }        ]    }}

您应该使用该

_parent
字段进行查询,并将该字段传递给您要将展览品限制到的位置的ID数组。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/368837.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号