Skip to content

Instantly share code, notes, and snippets.

Created July 19, 2011 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1092577 to your computer and use it in GitHub Desktop.
Save anonymous/1092577 to your computer and use it in GitHub Desktop.
Working mvel/geopoint array
// This works:
{
"query":{
"match_all":{}
},
"script_fields":{
"test1":{
"script":"i = 0; n = 0; d = 0; if (doc['locs'].values.length > 0) { d = doc['locs'].lons[0]; } d;"
}
},
"fields":["locs",
"test1"
]
}
// (eg, from elasticsearch-head:)
{
* took: 3
* timed_out: false
* _shards: {
o total: 5
o successful: 5
o failed: 0
}
* hits: {
o total: 198
o max_score: 1
o hits: [
+ {
# _index: doc_4db5c05fb246d25364aceca0
# _type: document_index
# _id: 4e028d1da0ec7d6e3d0da760
# _score: 1
# fields: {
* locs: [
o 33.30963383526028,44.389701534810726
o 33.30963383526028,44.389701534810726
]
* test1: 44.389701534810726
}
}
//(etc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment