我有一个数组这是形式的滤出结果:ElasticSearch:从阵列
[ { _index: 'people',
_type: 'items',
_id: '5450c69d9d3545a816df39d4',
_score: null,
_source:
{ _id: '5450c69d9d3545a816df39d4',
number: '2062',
bids: [Object] },
{ _index: 'people',
_type: 'items',
_id: '5450c69d9d3545a816df396d',
_score: null,
_source:
{ _id: '5450c69d9d3545a816df396d',
number: '2195',
bids: [Object] }
]
详细本期特价货品
{ _id: '5450c69d9d3545a816df391c',
number: '2004',
bids:
[ { collector: '5450c69a9d3545a816df311d',
state: 'losing',
createdAt: '2014-10-30T09:33:36.905Z',
amount: 10,
_id: '545205f01fc10e3816cb2073' },
{ collector: '5450c69a9d3545a816df311c',
amount: 20,
state: 'winning',
createdAt: '2014-10-30T09:29:38.561Z',
_id: '545205f01fc10e3816cb2074' } ]
}
欲应用过滤器,使得我可以过滤掉胜利和失败的投标。我想要一个返回这种类型结果的查询,即在这个项目上获胜的收藏家。
{ collector: '5450c69a9d3545a816df311c',
amount: 20,
state: 'winning',
createdAt: '2014-10-30T09:29:38.561Z',
_id: '545205f01fc10e3816cb2074' } ]
的映射是:
{
"bids": {
"properties": {
"_id": {
"type": "string"
},
"amount": {
"type": "long"
},
"collector": {
"type": "string"
},
"createdAt": {
"type": "date",
"format": "dateOptionalTime"
},
"state": {
"type": "string"
}
}
}
}
查询应该像collector=<id> AND bids.state="winning/losing"
会有什么实际ElasticSearch查询?
你可以发布你的映射吗? 'bids'被映射为'nested'或'object'? – ThomasC 2014-10-30 10:45:00
' “出价”:{ “属性”:{ “_id”:{ “类型”: “串” }, “量”:{ “类型”: “长” }, “集电极“:{ ”类型“: ”串“ }, ”createdAt“:{ ”类型“: ”日期“, ”格式“: ”dateOptionalTime“ }, ”状态“:{ ”类型“ :“string” } }' 查询应该像collector = AN D bids.state =“赢/输”。对? –
2014-10-30 10:56:24