我想像下面这样初始化一个空数组。我该怎么做?
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "customers",
"_type": "customer",
"_id": "QOTzXMUcrnbsYyFKeouHnjlkjQB3",
"_score": 1,
"_source": {
"uid": "QOTzXMUcrnbsYyFKeouHnjlkjQB3",
"email": "george@gmail.com",
"favorites": [], < ---- this is the problem
"history": [],
"settings": {},
"purchases ": [],
"created": 1507892081201,
"updated": 1507892081201
}
}
]
}
1条答案
按热度按时间8fq7wneg1#
我不确定我是否正确地回答了你的问题,但如前所述,如果你想避免
[]
在空数组中,只需使用null
值,以便您可以搜索和索引这些null
价值观。请参考elasticsearch的官方文档。