{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "categories",
"query": {
"terms": {
"categories.id": [
9
]
}
}
}
},
{
"terms": {
"deleted": [
false
]
}
},
{
"terms": {
"published": [
true
]
}
},
{
"nested": {
"path": "vendors",
"query": {
"terms": {
"vendors.isDeletedVendor": [
false
]
}
}
}
},
{
"nested": {
"path": "vendors",
"query": {
"terms": {
"vendors.isPublishedVendor": [
true
]
}
}
}
}
],
"should": [
{
"bool": {
"must": [
{
"bool": {
"should": [
{
"bool": {
"must_not": [
{
"nested": {
"path": "manufacturers",
"query": {
"exists": {
"field": "manufacturers"
}
}
}
}
]
}
}
]
}
},
{
"bool": {
"should": [
{
"nested": {
"path": "vendors",
"query": {
"terms": {
"vendors.id": [
87
]
}
}
}
}
]
}
}
]
}
},
{
"bool": {
"must": [
{
"bool": {
"should": [
{
"bool": {
"must_not": [
{
"nested": {
"path": "manufacturers",
"query": {
"exists": {
"field": "manufacturers"
}
}
}
}
]
}
}
]
}
},
{
"bool": {
"should": [
{
"nested": {
"path": "vendors",
"query": {
"terms": {
"vendors.id": [
56
]
}
}
}
}
]
}
}
]
}
}
]
}
},
"size": 1000,
"_source": {
"includes": [
"modelName",
"vendors.id",
"manufacturers.id",
"id"
]
}
}
所以我在这里做的是这样的:
从以下数据中选择* (manufacturerIds为null,vendorIds为87)或 (manufacturerIds为null,vendorIds为56)
但是它返回的结果是这样的:
"hits" : [
{
"_index" : "onoff-live",
"_type" : "_doc",
"_id" : "130011",
"_score" : 5.0,
"_source" : {
"modelName" : "Galaxy A20",
"manufacturers" : [
{
"id" : 216
}
],
"id" : 130011,
"vendors" : [
{
"id" : 23
}
]
}
}]
我不知道我要缺少什么,请给我建议,如果您想映射,我会在回复中发布...