Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Significant_terms aggregation Java API returns unformatted strings for Dates and IPs #17707

Closed
markharwood opened this issue Apr 13, 2016 · 2 comments
Assignees

Comments

@markharwood
Copy link
Contributor

The date and ip field types return unformatted strings for Bucket.getKeyAsString() in the signficant_terms aggregation responses. These values, like the REST api should return formatted values.

@markharwood
Copy link
Contributor Author

This issue may have become irrelevant.
As a result of the #17746 change it is not possible to to run significant_terms aggs on numeric-based fields and users will need to define a special string-based mapping for significant_terms analysis e.g:

        "myIpField": {
           "type": "ip",
           "fields":{
               "asKeyword":{
                   "type":"keyword"
               }
           }
        }

..and then run sig terms analysis on the myIpField.asKeyword version of the field.

We may return to this formatting issue if we figure out a way to reintroduce support for significant_terms on numeric types with their new scheme for Lucene indexing.

@markharwood
Copy link
Contributor Author

For the record, the formatting solution was simple - it was copying the format.format() call found in SignificantLongTerms.Bucket.toXContent method for the key_as_string JSON property and applying it to the corresponding getKeyAsString() method used by Java clients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant