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

Specifying not_analyzed for additional fields #41

Open
mcantrell opened this issue Jul 27, 2016 · 1 comment
Open

Specifying not_analyzed for additional fields #41

mcantrell opened this issue Jul 27, 2016 · 1 comment

Comments

@mcantrell
Copy link

The default type for string additional fields is analyzed. Is there a way to register the type for the additional fields?

For instance, we register additional fields to track the host:

   def customFields = [
           "host": InetAddress.getLocalHost().getHostName()
   ]
   def reporter = ElasticsearchReporter.forRegistry(registry)
           .hosts(hosts)
           .additionalFields(customFields)
           .build()

Our host names have a naming convention which separates the number of the instance:

  • api-01
  • api-02
  • etc..

This causes a split in the analyzed fields (api, 01, 02) when trying to visualize the data in kibana.

@mcantrell
Copy link
Author

I've created my own template via curl but it would be nice to specify the type along with the mapping or supply a custom template to be used in ElasticsearchReporter.checkForIndexTemplate

curl -XPUT localhost:9200/_template/metrics_template -d '
{
  "order": 0,
  "template": "metrics*",
  "settings": {},
  "mappings": {
    "_default_": {
      "properties": {
        "name": {
          "index": "not_analyzed",
          "type": "string"
        },
        "host": {
          "index": "not_analyzed",
          "type": "string"
        }
      },
      "_all": {"enabled": false}
    }
  },
  "aliases": {}
}
'

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

No branches or pull requests

1 participant