0
votes

I tried nested mapping in the following way.

PUT /xyz
{
  "mappings": {
    "logs": {
      "properties": {
        "startTime": {"type": "date",
                      "format": "HH:mm:ss" 
                     },
        "stopTime":  {"type": "date",
                      "format": "HH:mm:ss"
                     },
        "acceptedRequests": {"type": "integer"},
        "clientErrors": {"type": "integer"},
        "serverErrors": {"type": "integer"}
                   },
        "predicted":{"type":"nested",
          "properties":{
          "predict1": {"type":"nested",
            "properties":{
            "acceptedRequests":{"type":"integer"},
            "clientErrors": {"type": "integer"},
            "serverErrors": {"type": "integer"}
                        }
                      },
          "predict2": {"type":"nested",
            "properties":{
            "acceptedRequests":{"type":"integer"},
            "clientErrors": {"type": "integer"},
            "serverErrors": {"type": "integer"}                              }
                       },
          "predict3": {"type":"nested",
            "properties":{
            "acceptedRequests":{"type":"integer"},
            "clientErrors": {"type": "integer"},
            "serverErrors": {"type": "integer"}
                         }
                       }
                      }
                     }   
              }
}
}

I got an error stating "root_cause": [ { "type": "mapper_parsing_exception", "reason": "Root mapping definition has unsupported parameters: [type : nested]"

Any help is appreciated.

1

1 Answers

0
votes

You are getting the error because properties tag is closed before "predicted" property.Use the below mapping to correct the error

{
   "mappings":{
      "logs":{
         "properties":{
            "startTime":{
               "type":"date",
               "format":"HH:mm:ss"
            },
            "stopTime":{
               "type":"date",
               "format":"HH:mm:ss"
            },
            "acceptedRequests":{
               "type":"integer"
            },
            "clientErrors":{
               "type":"integer"
            },
            "serverErrors":{
               "type":"integer"
            }
         ,
         "predicted":{
            "type":"nested",
            "properties":{
               "predict1":{
                  "type":"nested",
                  "properties":{
                     "acceptedRequests":{
                        "type":"integer"
                     },
                     "clientErrors":{
                        "type":"integer"
                     },
                     "serverErrors":{
                        "type":"integer"
                     }
                  }
               },
               "predict2":{
                  "type":"nested",
                  "properties":{
                     "acceptedRequests":{
                        "type":"integer"
                     },
                     "clientErrors":{
                        "type":"integer"
                     },
                     "serverErrors":{
                        "type":"integer"
                     }
                  }
               },
               "predict3":{
                  "type":"nested",
                  "properties":{
                     "acceptedRequests":{
                        "type":"integer"
                     },
                     "clientErrors":{
                        "type":"integer"
                     },
                     "serverErrors":{
                        "type":"integer"
                     }
                  }
               }
            }
         }
         }
      }
   }
}