Scripted field not available in Rest API

Hi All,

I'm trying to fetch data from elasticsaerch using rest api, i'm able to get all the documents by running the below query

GET perfchk/_search?size=1000

I have created few scripted fields in this index, those scripted field datas are not showing up in the rest output, Is this a normal behaviour of elasticsearch or i'm missing something in the query.

Please advice.

Thanks
Gautham

Normal behavior. Use Discover if you want to see the output of scripted fields.

Scripted fields compute data on the fly from the data in your Elasticsearch indices. The data is shown on the Discover tab as part of the document data, and you can use scripted fields in your visualizations.

I'm able to view the field in discover tab and am able to create visualizations also thanks for that.

Actually i was trying to use rest api of elasticsearch to expose the data to another 3rd part tool, so was checking if the scripted field will be available using rest api?

Thanks
Gautham

Scripted fields are stored in .kibana index and I believe can only be used within Kibana (Visualizations and Discover).

When you query using Elastic API it doesn't reach out to .kibana to see if there are scripted fields to process. It just grabs the data per the query.

So the answer is you would just need to perform whatever transformations you were in the scripted field in your code after you grab the data.

1 Like

Thanks @aaron-nimocks This cleared my doubts.

Thanks
Gautham

The 7.11 release gave Runtime Fields. I have yet to test those but the documentation kind of suggests you might be able to do this now.

1 Like

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