我已经为Elasticsearch创建了一个插件并已成功安装(http:// localhost:9200/_nodes/plugins /显示它已安装.)但我似乎无法在我的查询中使用它 - 我只会收到错误."ScriptException [[groovy]动态脚本禁用]".好像我需要一个不同的lang设置.但我试过'lang':'java'.没有快乐.我试过郎:表达.然后我得到"ExpressionScriptCompilationException [表达式中的未知变量[maxmind]".如何访问我创建的插件?或者我是否需要做更多的事情来注册它?
我一直在关注这个优秀的指南:https: //github.com/imotov/elasticsearch-native-script-example
但它没有说明应该如何编写查询.
我的AbstractPlugin:
package org.elasticsearch.plugin.maxmind;
import java.util.Collection;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.inject.Module;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.script.ScriptModule;
import org.elasticsearch.plugin.maxmind.GeoLoc;
public class MaxMind extends AbstractPlugin {
@Override public String name() {
return "maxmind";
}
@Override public String description() {
return "Plugin to annotate ip addresses with maxmind geo data";
}
// Thanks https://github.com/imotov/elasticsearch-native-script-example
public void onModule(ScriptModule module) {
module.registerScript("geoloc", GeoLoc.Factory.class);
}
}
Run Code Online (Sandbox Code Playgroud)
请注意名称"geoloc".这是我在查询中使用的名称吗?
我的GeoLoc模块:
package org.elasticsearch.plugin.maxmind;
import java.util.HashMap;
import java.util.Map;
import …Run Code Online (Sandbox Code Playgroud) 是否可以对布尔过滤器中的特定字段使用多个术语条件?
query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"terms": {
"events": [
"abc",
"def",
"ghi",
"jkl"
]
},
"terms" : {
"users" : [
"user_1",
"user_2",
"user_3"
]
}
}
]
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
第一个术语过滤器工作正常,但我无法使用第二个术语,如果我对上述查询做错了什么,请更正。
我有来自JDBC输入的事件或行.
{"academic_session_id" : "as=1|dur=2015-16,as=2|dur=2016-17",
"branch_id" : 1}
Run Code Online (Sandbox Code Playgroud)
我想使用logstash过滤器将其转换或格式化为以下内容...
{"branch_id": 1,"sessions":[{"as":"1","dur":"2015-16"},{"as":"2","dur":"2016-17"}]}
Run Code Online (Sandbox Code Playgroud)
如果您可以建议任何替代logstash.注意 - 我使用的是Elasticsearch 5.X版本
elasticsearch logstash elasticsearch-plugin logstash-configuration
I'm having trouble trying to use the Ingest Attachment Processor Plugin with ElasticSearch (5.5 on AWS, 5.6 local). I'm developing in Python (3.6) and am using the elasticsearch-dls library.
I'm using Persistence and have my class set-up like this:
import base64
from elasticsearch_dsl.field import Attachment, Text
from elasticsearch_dsl import DocType, analyzer
lower_keyword = analyzer('keyword', tokenizer="keyword", filter=["lowercase"])
class ExampleIndex(DocType):
class Meta:
index = 'example'
doc_type = 'Example'
id = Text()
name = Text(analyzer=lower_keyword)
my_file = Attachment()
Run Code Online (Sandbox Code Playgroud)
I then have a …
python python-3.x elasticsearch elasticsearch-plugin elasticsearch-dsl
我正在尝试将Elasticsearch节点的快照存储库的配置设置为S3。
我已经为Elasticsearch 安装了“ repository-s3”插件。
PUT http://<username>:<password>@<elasticsearch-instance-ip>:9200/_snapshot/s3_repository?verify=false
{
"type": "s3",
"settings": {
"bucket": "bucket-name",
"region": "eu-west-1",
"access_key": "****",
"secret_key": "****"
}
}
Run Code Online (Sandbox Code Playgroud)
响应是:
{
"error": {
"root_cause": [
{
"type": "repository_exception",
"reason": "[s3_repository] failed to create repository"
}
],
"type": "repository_exception",
"reason": "[s3_repository] failed to create repository",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Setting [access_key] is insecure, but property [allow_insecure_settings] is not set"
}
},
"status": 500
}
Run Code Online (Sandbox Code Playgroud)
我曾尝试在elasticsearch.yml配置文件中应用allow_insecure_settings设置,但这不起作用。
仅供参考,我正在使用X-Pack插件
有什么建议么?
有人可以帮我在弹性搜索中获取嵌套对象的聚合计数,假设我的弹性搜索对象映射为:
{
"employe": {
"dynamic": "strict",
"properties": {
"empId":{
"type": "keyword"
},
"entities": {
"type": "nested"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
实体是具有其他对象的数组类型。我想获得过滤项目的实体数量。我尝试了一些弹性搜索查询,但它不起作用
{
"query": {
"bool": {
"filter": [
{
"terms": {
"empId": [12121,2121212]
}
}
]
}
},
"size": 0,
"aggs": {
"entities_agg": {
"sum": {
"field": "entities",
"script": {
"inline": "doc['entities'].values.size()"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud) javascript elasticsearch elasticsearch-plugin elasticsearch-5 kibana-5
概述:
我尝试了 API 和本地 Elasticsearch 之间的非安全连接,一切正常。为了确保连接安全,我执行了以下步骤在我的弹性体上添加 xpack 插件并在 api 中使用它:
我的代码在弹性配置中发生了变化:
@Bean
public TransportClient transportClient() throws UnknownHostException {
Settings settings = Settings.builder()
.put("cluster.name", clusterName)
.put("xpack.security.user", "api:apipass")
.build();
try (TransportClient client = new PreBuiltXPackTransportClient(settings)
.addTransportAddress(new TransportAddress(InetAddress.getByName(host), tcpPort))) {
String token = basicAuthHeaderValue("api", new SecureString("apipass".toCharArray()));
client.filterWithHeader(Collections.singletonMap("Authorization", token))
.prepareSearch().get();
return client;
}
}
Run Code Online (Sandbox Code Playgroud)
问题:
当尝试通过应用程序运行弹性查询时,将引发以下异常:
Caused by: java.lang.IllegalStateException: transport client is closed
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:243) ~[elasticsearch-6.0.0.jar:6.0.0]
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59) ~[elasticsearch-6.0.0.jar:6.0.0]
at …Run Code Online (Sandbox Code Playgroud) elasticsearch elasticsearch-plugin spring-boot spring-data-elasticsearch elasticsearch-x-pack
我有一个端点,我正在代理ElasticSearch API,用于我正在进行的简单用户搜索.
/users?nickname=myUsername&email=myemail@gmail.com&name=John+Smith
Run Code Online (Sandbox Code Playgroud)
Somet有关这些参数的详细信息如下
ElasticSearch搜索调用应将参数统称为AND'd.
现在,我不确定从哪里开始,因为我能够单独执行每个参数的查询,但不是全部.
client.search({
index: 'users',
type: 'user',
body: {
"query": {
//NEED TO FILL THIS IN
}
}
}).then(function(resp){
//Do something with search results
});
Run Code Online (Sandbox Code Playgroud) 是否可以将日期转换为毫秒?从下面的类型(表)中,当我想检索JoinDate列的数据时,应以总毫秒数显示时间。
示例2010-10-12 13:10:10(时间)==> 1291966810000(毫秒)
----------------------------------
|S.No | ID | JoinDate |
----------------------------------
| 1 | N107 | 2010-10-12 13:10:10 |
| | | |
| 2 | N108 | 2011-2-12 10:40:10 |
| | | |
| 3 | N109 | 2013-10-12 11:10:50 |
| | | |
------------------------------------
Run Code Online (Sandbox Code Playgroud) 我希望能够使用elasticsearch php库通过查询删除文档.我实际上想要删除我的类型中的所有文档.我可以使用正常的curl XDELETE请求来实现这一点,但是我无法使用弹性搜索的PHP库来使用它.
是的我已经安装了delete-by-query插件,因此原始请求有效.
我目前的代码:
$params = [
'index' => 'sanctions_lists',
'type' => $listName,
'body' => [
'query' => [
'match_all' => []
]
]
];
return $this->delete($params);
Run Code Online (Sandbox Code Playgroud)
结果是
Client.php第1440行中的InvalidArgumentException:id不能为null.
从我的错误消息(ID不能为空)它看起来删除查询可能是php库的限制只允许通过id删除.
如果我必须在我的应用程序内执行此函数的原始HTTP请求,当php库对应用程序中的其他查询非常有用时,会有点烦人.
问题摘要
有没有一种解决方法可以使用elasticsearch php库通过查询删除而无需触及库代码?
不言而喻,但感谢任何花时间查看和帮助我的问题的人.干杯.
编辑
包括它有助于我使用:
elasticsearch php库版本 v2.1.5
我已经从 Nuget 包管理器下载了弹性搜索客户端 Nest。
我无法识别检查服务器运行状况的功能。
请建议。
当我尝试安装我通过调用构建的插件时
./elasticsearch-plugin install file:///fullpath/to/zipfile/custome_plugin.zip
Run Code Online (Sandbox Code Playgroud)
它给了我这个错误:
ERROR: `elasticsearch` directory is missing in the plugin zip
Run Code Online (Sandbox Code Playgroud)
我正在阅读其他一些类似的帖子,许多人尝试安装 .jar 而不是 .zip。我确实尝试安装 .zip,但仍然显示相同的错误。
此外(可能与此问题无关),当我手动解压缩 zip 文件并将其放入插件文件夹时,elasticsearch-plugins list会列出自定义插件。在这种情况下,插件是一个自定义分析器,但不知何故映射无法识别分析器。是因为我没有正确安装吗?
编辑:
添加一点信息,当我关闭集群然后在插件手动解压缩并放入plugin目录后重新启动时,集群不会启动。我得到了看起来像的错误
[2017-08-31T11:15:52,668][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [] fatal error in thread [main], exiting
java.lang.NoClassDefFoundError: org/elasticsearch/index/analysis/AnalysisModule$AnalysisBinderProcessor
at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:1.8.0_65]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[?:1.8.0_65]
at java.lang.Class.getConstructor0(Class.java:3075) ~[?:1.8.0_65]
at java.lang.Class.getConstructor(Class.java:1825) ~[?:1.8.0_65]
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:423) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:387) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:140) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.node.Node.<init>(Node.java:312) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.2.jar:5.5.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.2.jar:5.5.2]
at …Run Code Online (Sandbox Code Playgroud) 在ES 5.x版本上工作,并且需要使用script更新多个字段。此外,还有更好的解决方案。
POST ../100/_update
{
"script" : {
"inline": "ctx._source.student.hobbies.add(params.tag)",
"lang": "painless",
"params" : {
"tag" : "cricket"
}
}
}
Run Code Online (Sandbox Code Playgroud)
同样的学生,我需要更新电话号码。现在我正在打电话给2 API的更新爱好和电话号码。寻找更好的解决方案来更新单个查询
elasticsearch ×13
amazon-s3 ×1
asp.net ×1
c# ×1
filter ×1
hadoop ×1
javascript ×1
kibana-5 ×1
logstash ×1
mongodb ×1
mongoose ×1
node.js ×1
php ×1
python ×1
python-3.x ×1
spring-boot ×1