Field Selector showing system fields (_index, _score). How to hide?

I added a Field Selector to my dashboard so users can swap metrics on the main chart. However, the dropdown list is huge, it shows every single field in the Elasticsearch index, including internal fields like _index, _score, and some sensitive fields I don’t want exposed.

Can I provide a whitelist?

Yes, the Field Selector does not have to show the entire schema. You have to restrict it in this way:

.set('fields', ['field_1.keyword', 'field_2', 'field_3'])

Where you can pass an array of field names and only these will render.

1 Like

I tested it this way and it’s working correctly. Only my metrics are included now, and the other fields are no longer displayed.

If you want only metrics you can do simethign like this instead:

.set('type', ['INTEGER', 'NUMBER', 'MONEY'])

That way you show only numeric fields

1 Like

Yes, that is better, thanks for your help