I try to add a custom script field which is a returns true if the document's id exists

I try to add a custom script field which is a returns true if the
document's id exists in an array but it does not work.
curl -XGET 'http://localhost:9200/type/index/_search?pretty' -d '{
"from" : 0,
"size" : 20,
"query" : {
"query_string" : {
"query" : "*",
"default_field" : "id"
}
},
"sort" : {
"_script" : {
"script" : "return friends_visits_ids contains (_fields._id.value)",
"type" : "string",
"order" : "asc",
"params" : {
"friends_visits_ids" : ["ce9c1f41-8a46-43b0-8ee8-a1fd76e339d8"]
}
}
}
}
'
And I can get return without sorting, like this:

{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 239,
"max_score" : null,
"hits" : [ {
"_index" : "momo",
"_type" : "help",
"_id" : "02766777-3128-4f00-a983-32080e791849",
"_score" : null, "_source" : {...},
"sort" : [ "[ce9c1f41-8a46-43b0-8ee8-a1fd76e339d8]" ]
}, {
"_index" : "momo",
"_type" : "help",
"_id" : "040d7285-2ce9-4f8f-b5d6-208c5f8ecf7c",
"_score" : null, "_source" : { ...},
"sort" : [ "[ce9c1f41-8a46-43b0-8ee8-a1fd76e339d8]" ]
},
....
}

How can I make it work?

--

I mean I want to custom the sorting.

--

Hi,

you need a fix in your MVEL syntax, stored _id field, and "doc" access
because it is faster.

Please try my suggestion at

Best regards,

Jörg

On Wednesday, November 28, 2012 4:31:52 AM UTC+1, Di Wu wrote:

I mean I want to custom the sorting.

--