我在 ES2.3 中有一个文件的映射如下
"move_in_ts": {
"type": "integer"
}
"move_out_ts": {
"type": "integer"
}
Sample document stores data as follows:
"move_in_ts": [
1475280000,
1475539200,
1475712000,
1475884800,
1477008000,
1477785600
]
我的 DSL 查询中有一个脚本(试图在该数组中查找一个整数)
"script": "if(doc['move_in_ts'] && doc['move_in_ts'].values.contains('1475280000')){return 200;}"
并且还尝试了这个:
"script": "if(doc['move_in_ts'] && doc['move_in_ts'].contains('1475280000')){return 200;}"
并且还尝试了这个:
"script": "if(doc['move_in_ts'] && doc['move_in_ts'].contains(1475280000)){return 200;}"
并且还尝试了这个:
"script": "if(doc['move_in_ts'] && doc['move_in_ts'].values.contains(1475280000)){return 200;}"
但在上述所有情况下,我都会收到以下错误:
"reason": {
"type": "null_pointer_exception",
"reason": null
}
有可能这个字段在少数文档中根本不存在(我不能在我的用例中使用过滤器,我只需要在脚本中使用它)
我做错了什么或如何让它工作?