I am trying to obtain metadata about the document types within an elasticsearch index. Any ideas on how I could retrieve the maximum length of a string field?
0
votes
1 Answers
0
votes
After enabling dynamic scripting the following did the trick for me (provided there where no nulls):
POST /myIndex/_search?Document' -d '
{
"query" : {
"filtered" : {
"filter" : {
"exists" : { "field" : "someField" }
}
}
},
"aggs" : {
"max_length" : { "max" : { "script" :doc['someField'].value.length()" } }
}
}