public function getFieldNamesFlat(
        Document $document,
        $documentPrefix = '',
        $exposedPrefix = '',
        callable $callback = null,
        $returnFullField = false
    ) {
        $result = [];
        foreach ($document->getFields() as $field) {
            if ($this->getFlatFieldCheckCallback($field, $callback)) {
                if ($returnFullField) {
                    $setValue = $field;
                } else {
                    $setValue = $exposedPrefix . $field->getExposedName();
                }
                $result[$documentPrefix . $field->getFieldName()] = $setValue;
            }

            if ($field instanceof ArrayField) {
                if ($this->getFlatFieldCheckCallback($field, $callback)) {
                    if ($returnFullField) {
                        $setValue = $field;
                    } else {
                        $setValue = $exposedPrefix . $field->getExposedName() . '.0';
                    }
                    $result[$documentPrefix . $field->getFieldName() . '.0'] = $setValue;
                }
            } elseif ($field instanceof EmbedOne) {
                $result = array_merge(
                    $result,
                    $this->getFieldNamesFlat(
                        $field->getDocument(),
                        $documentPrefix.$field->getFieldName().'.',
                        $exposedPrefix.$field->getExposedName().'.',
                        $callback,
                        $returnFullField
                    )
                );
            } elseif ($field instanceof EmbedMany) {
                if ($this->getFlatFieldCheckCallback($field, $callback)) {
                    if ($returnFullField) {
                        $setValue = $field;
                    } else {
                        $setValue = $exposedPrefix . $field->getExposedName() . '.0';
                    }
                    $result[$documentPrefix . $field->getFieldName() . '.0'] = $setValue;
                }
                $result = array_merge(
                    $result,
                    $this->getFieldNamesFlat(
                        $field->getDocument(),
                        $documentPrefix.$field->getFieldName().'.0.',
                        $exposedPrefix.$field->getExposedName().'.0.',
                        $callback,
                        $returnFullField
                    )
                );
            }
        }

        return $result;
    }