Cake\ElasticSearch\Datasource\MappingSchema::field PHP Method

field() public method

Can access nested fields through dot paths.
public field ( string $name ) : array | null
$name string The path to the field you want.
return array | null Either field mapping data or null.
    public function field($name)
    {
        if (strpos($name, '.') === false) {
            if (isset($this->data[$name])) {
                return $this->data[$name];
            }
            return null;
        }
        $parts = explode('.', $name);
        $pointer = $this->data;
        foreach ($parts as $part) {
            if (isset($pointer[$part]['type']) && $pointer[$part]['type'] !== 'nested') {
                return $pointer[$part];
            }
            if (isset($pointer[$part]['properties'])) {
                $pointer = $pointer[$part]['properties'];
            }
        }
    }