src/Sherlock/requests/IndexRequest.php
public function mappings($mapping)
    {
        $args = func_get_args();


        //@todo this is all horrible, burn it and rewrite

        foreach ($args as $arg) {

            if ($arg instanceof \Sherlock\components\MappingInterface) {

                //is this a core type?  Wrap in 'properties'
                if (!($arg instanceof \Sherlock\components\mappings\Analyzer)) {
                    $mappingValue = array("properties" => $arg->toArray());
                } else {
                    $mappingValue = $arg->toArray();
                }

                if (isset($this->params['indexMappings'][$arg->getType()])) {
                    $this->params['indexMappings'][$arg->getType()] = array_merge_recursive(
                        $this->params['indexMappings'][$arg->getType()],
                        $mappingValue
                    );
                } else {
                    $this->params['indexMappings'][$arg->getType()] = $mappingValue;
                }
            } elseif (is_array($arg)) {
                foreach ($arg as $argMapping) {

                    //is this a core type?  Wrap in 'properties'
                    if (!($arg instanceof \Sherlock\components\mappings\Analyzer)) {
                        $mappingValue = array("properties" => $argMapping->toArray());
                    } else {
                        $mappingValue = $argMapping->toArray();
                    }

                    if (isset($this->params['indexMappings'][$argMapping->getType()])) {
                        $this->params['indexMappings'][$argMapping->getType()] = array_merge_recursive(
                            $this->params['indexMappings'][$argMapping->getType()],
                            $mappingValue
                        );
                    } else {
                        $this->params['indexMappings'][$argMapping->getType()] = $mappingValue;
                    }
                }
            } else {
                throw new \Sherlock\common\exceptions\BadMethodCallException("Arguments must be an array or a Mapping Property.");
            }


        }

        return $this;
    }
public function mappings($mapping)
    {
        $args = func_get_args();


        //@todo this is all horrible, burn it and rewrite

        foreach ($args as $arg) {

            if ($arg instanceof \Sherlock\components\MappingInterface) {

                //is this a core type?  Wrap in 'properties'
                if (!($arg instanceof \Sherlock\components\mappings\Analyzer)) {
                    $mappingValue = array("properties" => $arg->toArray());
                } else {
                    $mappingValue = $arg->toArray();
                }

                if (isset($this->params['indexMappings'][$arg->getType()])) {
                    $this->params['indexMappings'][$arg->getType()] = array_merge_recursive(
                        $this->params['indexMappings'][$arg->getType()],
                        $mappingValue
                    );
                } else {
                    $this->params['indexMappings'][$arg->getType()] = $mappingValue;
                }
            } elseif (is_array($arg)) {
                foreach ($arg as $argMapping) {

                    //is this a core type?  Wrap in 'properties'
                    if (!($arg instanceof \Sherlock\components\mappings\Analyzer)) {
                        $mappingValue = array("properties" => $argMapping->toArray());
                    } else {
                        $mappingValue = $argMapping->toArray();
                    }

                    if (isset($this->params['indexMappings'][$argMapping->getType()])) {
                        $this->params['indexMappings'][$argMapping->getType()] = array_merge_recursive(
                            $this->params['indexMappings'][$argMapping->getType()],
                            $mappingValue
                        );
                    } else {
                        $this->params['indexMappings'][$argMapping->getType()] = $mappingValue;
                    }
                }
            } else {
                throw new \Sherlock\common\exceptions\BadMethodCallException("Arguments must be an array or a Mapping Property.");
            }


        }

        return $this;
    }
Set the mappings that are used for various operations (set mappings, index creation, etc)

@todo fix array-only input
@todo add json input

@param  array|\sherlock\components\MappingInterface|bool   $mapping,...

@throws \Sherlock\common\exceptions\BadMethodCallException
@return \Sherlock\requests\IndexRequest