basemkhirat/elasticsearch

Most of the collection methods don't work on the returned results set.

Opened this issue · 0 comments

Hey so I've noticed that even though the returned collection is a Laravel Collection most of the functions return empty sets.

For example:

        $model= $elasticModel->take(3000)->get();

        dd($model->only('timestamp'));

Returns

Collection {#1424 ▼
  #items: []
}

Example of the model that if just dumped out (dd($model))

Collection {#1382 ▼
  #items: array:15 [▼
    0 => Model{#1367 ▼
      #type: "dummy"
      #fieldMapHuman: array:5 [▶]
      #client: null
      #index: "dummy-03-2018"
      #timestampField: "timestamp"
      -fields: null
      -query: null
      -dateRange: null
      -queryFields: null
      -sensorHost: null
      #connection: "default"
      #casts: []
      #attributes: array:24 [▼
        "agent" => array:3 [▶]
        "srcip" => "10.201.200.3"
        "offset" => 4786823
        "manager" => array:1 [▶]
        "input_type" => "log"
        "rule" => array:7 [▶]
        "decoder" => array:1 [▶]
        "type" => "hids"
        "url" => "/layout/menu?url=%2Fdirector%2Fhosts"
        "tags" => array:1 [▶]
        "full_log" => "10.201.200.3 - - [20/Mar/2018:13:31:29 +0000] "....../hosts ▶"
        "@timestamp" => "2018-03-20T13:31:32.530Z"
        "@version" => "1"
        "beat" => array:3 [▶]
        "host" => "dummyhost.com"
        "json" => true
        "location" => "/var/log/nginx/access.log"
        "id" => "401"
        "timestamp" => "2018 Mar 20 13:31:30"
        "fiarone" => array:3 [▶]
        "_index" => "dummy-03-2018"
        "_type" => "hids"
        "_id" => "AWJDm6iJN2j_-NxUNRsU"
        "_score" => 0.0
      ]
      #exists: false
      #appends: []
      -castTypes: array:10 [▶]
      +"_id": "AWJDm6iJN2j_-NxUNRsU"
    }
    1 => Model{#1368 ▶}
   .....

Clearly you can see it has a timestamp attribute.

Methods that I've tested that don't work are

pluck

key

sort

only