code: protected function mapSchema(Schema $schema, \stdClass $rootObject, $path = null)
      {
          $map = [];
  
          foreach ($schema->getFields() as $field) {
              $fieldName = $field->getName();
              $type = $field->getType();
              $fieldPath = empty($path) ? $fieldName : $path . '.' . $fieldName;
  
              if ($fieldName === Schema::PBJ_FIELD_NAME) {
                  $map[$fieldName] = ['type' => 'keyword', 'include_in_all' => false];
                  continue;
              }
  
              $method = 'map' . ucfirst(StringUtils::toCamelFromSlug($type->getTypeValue()));
  
              if ($field->isAMap()) {
                  $templateName = str_replace('-', '_', SlugUtils::create($fieldPath . '-template'));
                  if (is_callable([$this, $method])) {
                      $rootObject->dynamic_templates[] = [
                          $templateName => [
                              'path_match' => $fieldPath . '.*',
                              'mapping'    => $this->$method($field, $rootObject, $fieldPath),
                          ],
                      ];
                  } else {
                      $rootObject->dynamic_templates[] = [
                          $templateName => [
                              'path_match' => $fieldPath . '.*',
                              'mapping'    => $this->applyAnalyzer(
                                  $this->types[$type->getTypeValue()],
                                  $field,
                                  $rootObject,
                                  $path
                              ),
                          ],
                      ];
                  }
              } else {
                  if (is_callable([$this, $method])) {
                      $map[$fieldName] = $this->$method($field, $rootObject, $fieldPath);
                  } else {
                      $map[$fieldName] = $this->applyAnalyzer(
                          $this->types[$type->getTypeValue()],
                          $field,
                          $rootObject,
                          $path
                      );
                  }
              }
          }
  
          return $map;
      }
docs: @param Schema    $schema
  @param \stdClass $rootObject
  @param string    $path
  
  @return array