Commit c6497277 authored by Oleksii Pass's avatar Oleksii Pass
Browse files

changed source to elastic v.7

parent 1ef98dd0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ class ElasticquentResultCollection extends \Illuminate\Database\Eloquent\Collect
     */
    public function totalHits()
    {
        return $this->hits['total'];
        return $this->hits['total']['value'];
    }

    /**
+6 −7
Original line number Diff line number Diff line
@@ -369,8 +369,7 @@ trait ElasticquentTrait
    public function getBasicEsParams($getIdIfPossible = true, $limit = null, $offset = null)
    {
        $params = array(
            'index' => $this->getIndexName(),
            'type' => $this->getTypeName(),
            'index' => $this->getIndexName()
        );

        if ($getIdIfPossible && $this->getKey()) {
@@ -456,7 +455,7 @@ trait ElasticquentTrait
            'properties' => $instance->getMappingProperties(),
        );

        $mapping['body'][$instance->getTypeName()] = $params;
        $mapping['body'] = $params;

        return $instance->getElasticSearchClient()->indices()->putMapping($mapping);
    }
@@ -531,7 +530,7 @@ trait ElasticquentTrait

        $mappingProperties = $instance->getMappingProperties();
        if (!is_null($mappingProperties)) {
            $index['body']['mappings'][$instance->getTypeName()] = [
            $index['body']['mappings'] = [
                '_source' => array('enabled' => true),
                'properties' => $mappingProperties,
            ];