Histogram aggregation?

I have a phone number as one of my fields. Is it possible to bucket by the area code? Do I have to make that a separate field in the document ahead of time or can I calculate the area code from the phone number field and make that the bucket.

Hi Steve,
I'm pretty sure you would have to make that a separate field in the documents.

The only exception way I could think of without that, is if the phone number were a number data type you could possibly create a scripted field named area_code with a script like doc['phone_number'].value / 10000000. That might possibly truncate the number to just the first 3 digits. But phone numbers often are string types and scripted fields only work on numbers.


1 Like