Transform Object mapping to String mapping

Hello,

I'm quite new to ES and I'd like to know if it's possible to "convert" a field in a JSON document query represented as a JSON Object to a String.
Here is my JSON :

 {
	"basketId": {
		"value": "myBasket"
	},
	"lockerName": "chris",
	"status": "NEW"
}

The basketId.value doesn't bring anything so I'd like it to be stored as a

"basketId": "myBasket"

Is it possible to transform the input JSON into something where I have this "basketId": "myBasket" ? I thought I could achieve it by using mapping, but I'm not sure of it.

Thanks for your help !

you can not change your mapping if you already index one document, you need to delete your index and change the object to string (change your template or mapping file if defined) and index again !

I'm creating the mapping first, then I index my document.
It is possible to make my json document (with object) match the mapping (with string instead of the object) ?

i'm not sure for the object (for nested i'm sure you cant), but i don't understand why you like to define in your json document as an object and index your doc field like a string?
after they will be difficult to write queries, how you request this field as an object or string ?

i think so the best option if you don't use the object is to defined as a string in the mapping file, after you index your documents.

if you have for the same field mixed types like string and array, in your code (phyton, php...) cast in object or in string every time !

The problem is I don't have control over the incoming document and it will be structured as an object, but I don't like it and prefer the string one. That's why I'm trying to convert the object to a string through mapping.