Scripting

I've written the following script and am running it using dev tools


The first time I ran it, the field "result" said "created". As you can see from the screenshot, I've run this code a couple of times. Reason being, When I go back onto the 'discover' tab in kibana, there is no new field created called 'full_name'. I dont understand what's going on here, where is this field now and how do I get it to display? I would like to use it to later in Kibana...
If my approach is wrong, whats another way to create a new field and copy over the value of an existing field into that new field?
I have triped the 'copy_to' approach like so:

PUT somelistcopy/_mapping/doc
{
  "properties": {
    "parsed.FIRST_NAME": {
      "type": "text",
      "copy_to": "full_name" 
    },
    "full_name": {
      "type": "text"
    }
  }
}

But it doesn't actually create a new field in the mapping which you can use later in Kibana to visualise anything...

Your example PUT request is indexing the entire json there. Are you trying to do an update by query?

Uhh possibly,
If I were to do an update by query, would i be able to use the new variable in Kibana?

An update by query would reindex your documents, allowing you to add the new field in with the update. Kibana can then do anything you can normally do with fields in elasticsearch. Note this is not kibana scripted fields.

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