Field not appearing in index after refreshing the field list

I'm using @elastic/apm in a JavaScript client to send errors to Elastic, via .captureError(err). I've added a custom property status to the error to send the status code of a http response.

I can see the status appearing in the events as context.status (below), but I cannot make queries on it as it's not in the index.
image

I followed the tooltip instructions, but the field is not being added to the index. We've refreshed it several times, without errors: I've looked in the devtools console and network tabs and nothing is erring. Also the response from /api/index_patterns/_fields_for_wildcard does not contain the new field. I've refreshed several times today, as has my admin, with no luck.

I'd really like to get it into the index so I can monitor for status codes >=400. Is there anything I can do? Is it an asynchronous process that might take some time to complete?

Thanks,
Henry

Hi and welcome to the forum :tada:

The problem is that context is explicitly mapped as not indexed in the Elasticsearch mapping. In order to add a custom indexed property, you can use the addTags API to do that.

When using version 6.x of the stack, the property would be stored under tags.status, for example. In version 7.x of the stack, the property is stored as labels.status.

I hope that helps :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.