Giter Club home page Giter Club logo

elasticsearch's People

Contributors

filefox avatar mowangjuanzi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

elasticsearch's Issues

Can not find user: anonymous

es 有账号密码时添加数据报错:

{"status":401,"message":"Can not find user: anonymous"}

创建索引时:

    $hosts  = [
        config("elasticsearch.host")
    ];
    $client = ClientBuilder::create()
                           ->setHosts($hosts) 
                           ->setBasicAuthentication(config("elasticsearch.username"), config("elasticsearch.password"))
                           ->build();

可以正常执行,那添加数据时,如何传递账号密码?

$this->builder->index($index);

关于 No alive nodes found in your cluster in 问题

composer下来后运行查询报错
product.ERROR: Elasticsearch\Common\Exceptions\NoNodesAvailableException: No alive nodes found in your cluster in F:\WNMP\WWW\product_houtai_hn\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php:53
Stack trace:

百度好久了找不到解决方法呃。。。

orWhereMatch的默认参数有问题

public function orWhereMatch($field, $value, $boolean = 'and'): self
{
return $this->whereMatch($field, $value, $boolean);
}
应该是:
public function orWhereMatch($field, $value, $boolean = 'or'): self
{
return $this->whereMatch($field, $value, $boolean);
}

怎么获取 aggBy 得到的数据

public function get(): Collection
{
     $results = $this->runQuery($this->grammar->compileSelect($this));

     return $this->metaData($results);
}

protected function metaData(array $results): Collection
{
     return collect($results['hits']['hits'])->map(function ($hit) {
          return $this->sourceToObject($hit);
      });
}

这里直接抛弃了 aggregations 中的数据,仅返回 hits 数据么,那我该怎么获取aggregations中的数据呢?

Builder类分页paginate方法有报错

        $maxPage = intval(ceil($results['hits']['total'] / $perPage));

        return collect([
            'total'        => $results['hits']['total'],
            'per_page'     => $perPage,
            'current_page' => $page,
            'next_page'    => $page < $maxPage ? $page + 1 : $maxPage,
            //'last_page' => $maxPage,
            'total_pages' => $maxPage,
            'from'        => $from,
            'to'          => $from + $perPage,
            'data'        => $data,
        ]);

应改为

       $maxPage = intval(ceil($results['hits']['total']['value'] / $perPage));

        return collect([
            'total'        => $results['hits']['total']['value'],
            'per_page'     => $perPage,
            'current_page' => $page,
            'next_page'    => $page < $maxPage ? $page + 1 : $maxPage,
            //'last_page' => $maxPage,
            'total_pages' => $maxPage,
            'from'        => $from,
            'to'          => $from + $perPage,
            'data'        => $data,
        ]);

因为$results打印为

array:4 [▼
  "took" => 5
  "timed_out" => false
  "_shards" => array:4 [▼
    "total" => 1
    "successful" => 1
    "skipped" => 0
    "failed" => 0
  ]
  "hits" => array:3 [▼
    "total" => array:2 [▼
      "value" => 176
      "relation" => "eq"
    ]
    "max_score" => 1.0
    "hits" => array:15 [▶]
  ]
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.