Edit static lookup with API

I have the following problem. I have an X field in every document, but not in every document I have a Y field. I would like the information from field Y to appear in place of field X. Specifically, it is about the occurrences of documents where there is no field Y so that the field X contains this information - in each document. I'm assuming that scripting this and querying Kibana in real time would put a lot of strain on the system.

The simplest approach I see is data enrichment with static lookup. Every once in a while I do a query to ES where I retrieve the information, and then send that as a static lookup.

How do I update the static lookup using the API? I tried http://localhost:5601/api/data_views/data_view/<id from kibana links> but I see all the data view there, how to see the selected Name? I tried to add /name (where name is name of my field X) at the end but it returns 404. In addition, how to overwrite these values with API/curl in this case?

I was looking for that today and reach to your issue. Please let me know if you find the solution.