问题标签 [elasticsearch-php]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
252 浏览

elasticsearch - 无法使用 ElasticSearch-PHP 更新 ES 设置

ES中已经有索引了。我使用 ElasticSearch-PHP 作为客户端。根据ES 文档, 这些代码应该更改 ES 设置:

但是在运行代码后会显示此错误:

我该如何解决?先感谢您。

0 投票
3 回答
144 浏览

php - 将 CURL 命令转换为 CURL php

我正在尝试通过批量 API 将文档添加到弹性搜索索引。我的 CURL 查询在命令行上运行良好,我将其转换为 PHP。

当我尝试运行 PHP 代码时,什么也没有发生。弹性搜索中没有将文档添加到索引中,也没有出现任何错误。

卷曲查询:

PHP 查询:

我也设置ini_set('max_execution_time', 0);了,以防万一,它超时了。可能是什么问题?

0 投票
1 回答
208 浏览

elasticsearch - ElasticSearch 过滤多个必填字段

我对 ElasticSearch 6.2 有这个查询(通过 PHP 客户端):

row.name如果我只对or使用一次搜索,row.origin它就可以工作,但两者都像 OR 一样工作并返回所有结果。如何过滤以仅返回与row.nameAND完全匹配的文档row.origin

0 投票
0 回答
342 浏览

php - 为什么我在 Elasticsearch php 搜索基本查询中得到这个非法参数异常?

我正在使用 Elasticsearch PHP 包来执行查询。当我执行这个基本搜索查询时,我得到illegal_argument_exception. 该函数 elastic()返回 Elasticsearch 的客户端。

错误:

0 投票
2 回答
300 浏览

php - Elasticsearch Mapping Types in PHP

I want to connect to our elasticsearch Server (V7.0.0) using the official PHP Client. The elasticsearch Documentation states that mapping types have been removed in Version 6.0.0.

But in the whole official PHP Client documentation types are still mentioned and seem necessary (e.g.):

Source

Can anyone explain to me why I still have to use types when they have been removed?

0 投票
0 回答
431 浏览

xampp - 需要一些关于 Elasticsearch php 的指导

我需要一些帮助来理解以下内容,

  1. 我正在使用 composer 进行弹性搜索 php 集成。我创建了一个 html 页面来将表单数据发布到 elasticsearch 中。我正在尝试通过将 localhost ip 更改为我托管 html 页面的系统 ip 从另一台 pc 访问 html 页面。但我得到了错误。

致命错误:未捕获的 Elasticsearch\Common\Exceptions\NoNodesAvailableException:C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php:50 堆栈跟踪:# 0 C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(77): Elasticsearch\ConnectionPool\StaticNoPingConnectionPool->nextConnection() #1 C:\xampp\htdocs\Client_portal\vendor\ elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(94): Elasticsearch\Transport->getConnection() #2 C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php( 269): Elasticsearch\Transport->performRequest('POST', '/sib_api/_doc', 数组, '{"requestid":"#...',数组)#3 C:\xampp\htdocs\Client_portal\vendor\react\promise\src\FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections{closure}(数组)#4 C:\xampp \htdocs\Client_portal\vendor\guzzlehttp\ringphp\sr 在 C:\xampp\htdocs\Client_portal\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php 第 50 行

  1. 为了解决上述问题,我尝试使用完整路径(即)http://localhost:8080/client_portal/vendor/autoload.php调用 autoload.php 文件

但是现在我遇到了另一个错误

致命错误:未捕获的错误:在 C:\xampp\htdocs\Client_portal\Elastic_api.php:19 中找不到类 'Elasticsearch\ClientBuilder' 堆栈跟踪:#0 {main} 在 C:\xampp\htdocs\Client_portal\Elastic_api 中抛出。第 19 行的 php

有人可以帮我解决这个问题...并指导我如何从另一个系统访问我的 html 页面而没有任何问题。

//上面的行是我得到错误的地方......

0 投票
1 回答
2132 浏览

elasticsearch - 使用 Elasticsearch-PHP ClientBuilder 指定 elasticsearch 用户名/密码

我已经激活了默认的“弹性”用户并为该用户设置了密码。我正在使用elasticsearch-php 来连接和查询我的elasticsearch。它运行良好,但在激活密码后,我无法使用以前的代码进行连接。

在寻找使用 ClientBuilder 提供身份验证信息时,我只获得有关 ssh 连接的配置。没有找到任何东西我如何在连接中使用我的弹性搜索用户名和密码。

我想知道如何在上面的连接中使用我的用户名/密码。

0 投票
0 回答
35 浏览

elasticsearch - 如何计算一组文档中出现次数最多的单词然后执行子聚合

Elasticsearch 查询中,我可以生成大约 5000 个文档现在,我正在尝试确定哪些非停用词(停用词是辅助动词/非重要词)出现最多。

所以我使用显着文本聚合尝试了这个查询

不幸的是,它仍然显示一些对我来说garbage words不重要

在此处输入图像描述

我的问题: 1.聚合
是否有替代方案?significant_text

  1. 我还想terms在这个主aggs之后进行子聚合significant_text,因为我想结合一个查询知道流行词,然后根据其他字段过滤文档

如果您知道如何执行此所需的过程和输出,将不胜感激

0 投票
1 回答
326 浏览

php - PHP Elasticsearch 7.5 - 无痛脚本条件未提供正确结果

这是我的弹性搜索查询。我正在尝试获取所有满足 ifjob_id为 1 条件的文档,然后获取具有sourced = 0else ifjob_id不是 1 的文档,然后获取具有sourced = 1.

但它会返回所有文件。

引用字段的映射

0 投票
1 回答
568 浏览

php - Search with "And" operator in Elastic search PHP package

I'm trying to learn Elastic Search with help of php composer package. I'm having a index with the name of media_data which contains nits_account, nits_url, session_id, timestamp fields. I want to have filters based on above fields and it should be in and operator. my current query code is:

My question:

  1. I'm unable to fetch data. But if I do below code:

    /li>

I get values in or operators, but need to have and operation in it.

  1. How can I have different search operations with respective fields, I mean I want to have nits_account field to be exact match, I want to have nits_url with like/wildcard operations, timestamp should be comparable (greater than/less than/between two dates).