PHP将对象数组立即推送到elasticsearch

时间:2017-11-22 15:05:27

标签: php elasticsearch guzzle

我的阵列推送有点问题。我正在尝试做的是将对象数组推送到elasticsearch。我听说过批量选项“$ this-> elastic-> bulk($ arrayOfObject);”它在我的情况下不起作用,因为我的数组是自动编号的。这个错误的样子如下:

        [Elasticsearch\Common\Exceptions\UnexpectedValueException]                                               
          "0" ... "724" are not valid parameters. Allowed parameters are "_source", "_source_exclude", "_so  
          urce_include", "client", "consistency", "custom", "fields", "filter_path", "human", "pipeline", "pipeli  
          ne", "refresh", "replication", "type"

这就是我的对象的样子:

[724] => Array
    (
        [index] => pans
        [type] => 53
        [id] => 1514
        [body] => Array
            (
                [id] => 15221
                [name] => 1
                [location] => Array
                    (
                        [0] => 2099856.62422
                        [1] => 6524156.34668
                    )

                [angle] => 234.244154361
                [bugs] => 114
                [serial_no] => 104/5411
                [delayed] => 2
            )

    ))

任何想法我该怎么办? :)

PS。我不想用于循环。

0 个答案:

没有答案