Field length validation using ES and matched from ES document

Hello ES Team,

I have criteria for searching field length from json file using ES query.
lets say example .

I have a index 'A' - it contains json file documents.
Now i need to validate a field lenght is matching in that json or not

example :
{
" name" :"10"
"city" " " "
"location ": " IN"
}

Now i need verify and match from the index and to validate the length of name filed is 10 or not
and city is blank or not , location is IN or not .

By suing ES queries + java.
How can i write .any suggestions

Best thing to do is probably to compute the length at index time and provide it within your json document.