Here is My query , I am using elastic search 6.2 and my java version is 1.9
GET /users_small/user/_search
{
"_source": [
"id",
"username",
"full_name",
"picture",
"message_privacy"
],
"from": 0,
"size": 1000,
"sort": [
{
"username.raw": {
"order": "asc"
}
}
],
"query": {
"bool": {
"must": [
{
"terms": {
"id": [
5
]
}
},
{
"terms": {
"message_privacy": [
0,
1
]
}
},
{
"terms": {
"id": [
5
]
}
},
{
"script": {
"script": {
"source": "List followings = new ArrayList(params._source['followings']); List followers = new ArrayList(params._source['followers']); if(followers.contains(params.keyword)) { return true } else if(followings.contains(params.keyword)) { return true; } else { return false; }",
"lang": "painless",
"params": {
"keyword": 14
}
}
}
}
],
"must_not": [
{
"terms": {
"id": [
"7195",
"1154",
"3464",
"8562",
"2874",
"6522",
"8721",
"9196",
"3318",
"13986",
"8693",
"7201",
"9546",
"7240",
"18042",
"6013",
"6999",
"19419",
"3984",
"17688",
"9244",
"28335",
"850",
"28777",
"8625",
8625
]
}
}
],
"filter": []
}
}
}
but i am getting following error
{
"took": 11,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 4,
"skipped": 0,
"failed": 1,
"failures": [
{
"shard": 1,
"index": "users_small",
"node": "mK14IuVHTDKgHLnYYoXGqQ",
"reason": {
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"followings = new ArrayList(params._source['followings']); List ",
" ^---- HERE"
],
"script": "List followings = new ArrayList(params._source['followings']); List followers = new ArrayList(params._source['followers']); if(followers.contains(params.keyword)) { return true } else if(followings.contains(params.keyword)) { return true; } else { return false; }",
"lang": "painless",
"caused_by": {
"type": "null_pointer_exception",
"reason": null
}
}
}
]
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}