Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Elastica\Exception\ResponseException,消息为NoShardAvailableActionException[[index][0]null]_Php_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Elastica - Fatal编程技术网 elasticsearch,elastica,Php,elasticsearch,Elastica" /> elasticsearch,elastica,Php,elasticsearch,Elastica" />

Php Elastica\Exception\ResponseException,消息为NoShardAvailableActionException[[index][0]null]

Php Elastica\Exception\ResponseException,消息为NoShardAvailableActionException[[index][0]null],php,elasticsearch,elastica,Php,elasticsearch,Elastica,我正在使用php elastica client()在elasticsearch索引中添加文档 发生的情况是,我第一次尝试添加文档时,出现以下错误: 带有消息的“Elastica\Exception\ResponseException” 'NoSharedAvailableActionException[[index][0]null]; 嵌套:illegalindexhardstateException[[index][0] 仅在以下情况下才允许CurrentState[恢复]操作 启动/重新定

我正在使用php elastica client()在elasticsearch索引中添加文档

发生的情况是,我第一次尝试添加文档时,出现以下错误:

带有消息的“Elastica\Exception\ResponseException” 'NoSharedAvailableActionException[[index][0]null]; 嵌套:illegalindexhardstateException[[index][0] 仅在以下情况下才允许CurrentState[恢复]操作 启动/重新定位

文档不会添加到索引中,但会创建其映射

在这之后,它工作正常,文档被添加到索引中。 也许(相当肯定)我做错了什么。请帮我解决这个问题

以下是我的yaml配置:

indexes:
    myIndex:
        client: default
        types:
            myType:
                mappings:
                    id: {type: integer, index: not_analyzed}
                    name: {type: string, index: not_analyzed}
                    location: {type: geo_point}
下面是我如何添加文档的:

$doc = new \Elastica\Document();
$doc->setData($arrDoc);
$doc->setId($id); 
$objType->addDocument($doc); //object of \Elastica\Type