lib/Elastica/Document.php
public function addFile($key, $filepath, $mimeType = '')
    {
        $value = \base64_encode(\file_get_contents($filepath));

        if (!empty($mimeType)) {
            $value = ['_content_type' => $mimeType, '_name' => $filepath, '_content' => $value];
        }

        $this->set($key, $value);

        return $this;
    }
public function addFile($key, $filepath, $mimeType = '')
    {
        $value = \base64_encode(\file_get_contents($filepath));

        if (!empty($mimeType)) {
            $value = ['_content_type' => $mimeType, '_name' => $filepath, '_content' => $value];
        }

        $this->set($key, $value);

        return $this;
    }
public function addFile ( $ key , $ filepath , $ mimeType = '' ) { $ value = \ base64_encode ( \ file_get_contents ( $ filepath ) ) ; if ( ! empty ( $ mimeType ) ) { $ value = [ '_content_type' => $ mimeType , '_name' => $ filepath , '_content' => $ value ] ; } $ this -> set ( $ key , $ value ) ; return $ this ; }
Adds a file to the index.

To use this feature you have to call the following command in the
elasticsearch directory:
<code>
./bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.6.0
</code>
This installs the tika file analysis plugin. More infos about supported formats
can be found here: {@link http://tika.apache.org/0.7/formats.html}

@param string $key      Key to add the file to
@param string $filepath Path to add the file
@param string $mimeType OPTIONAL Header mime type

@return $this
Adds a file to the index .