如何在elasticsearch和python中初始化标记数组列表

brtdzjyr  于 2021-06-14  发布在  ElasticSearch
关注(0)|答案(1)|浏览(297)

我想像下面这样初始化一个空数组。我该怎么做?

"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
                }
            }
        ]
    }
8fq7wneg

8fq7wneg1#

我不确定我是否正确地回答了你的问题,但如前所述,如果你想避免 [] 在空数组中,只需使用 null 值,以便您可以搜索和索引这些 null 价值观。请参考elasticsearch的官方文档。

相关问题