stephenb  
                (Stephen Brown)
               
              
                  
                    May 26, 2023,  7:11pm
                   
                   
              3 
               
             
            
              Here is a little further explanation of what is happening
  
  
    Try this test, hopefully this makes it clearer 
POST test/_doc
{
  "myfield" : "myvalue",
  "myotherfield" :
  {
    "mysubfield1" : "mysubvalue1",
    "mysubfield2" : "mysubvalue2"
  }
}
Then Post 
POST test/_doc
{
  "myfield" : "myvalue",
  "myotherfield" : "myconcretevalue"
}
and you will get this error. 
{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "object mapping for [myotherfield] tried to parse field [myotherfield] as objec…
   
 
And Here is a sample code how you might fix something like this with an ingest pipeline.
  
  
    Just in case you are interest here is a sample ingest pipeline / simulate with various combinations 
## Ingest Pipeline Concrete / Object
POST _ingest/pipeline/_simulate
{
  "pipeline": {
    "processors": [
      {
        "rename": {
          "if": "ctx?.notes instanceof String", 
          "field": "notes",
          "target_field": "notes.value",
          "ignore_failure": false
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
        "id": "8f22efb2-6a2a-4cb7-9d0b-01ca0d6…