我有以下ElasticSearch查询,我认为会返回电子邮件字段中的所有匹配项,它等于myemails@email.com
"query": {
"bool": {
"must": [
{
"match": {
"email": "myemail@gmail.com"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
}
正在搜索的用户类型的映射如下:
{
"users": {
"mappings": {
"user": {
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"index": "not_analyzed"
}
}
},
"nickname": {
"type": "string"
},
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
以下是从ElasticSearch返回的结果示例
[{
"_index": "users",
"_type": "user",
"_id": "54b19c417dcc4fe40d728e2c",
"_score": 0.23983537,
"_source": {
"email": "johnsmith@gmail.com",
"name": "John Smith",
"nickname": …Run Code Online (Sandbox Code Playgroud) 我有一个带有弹性搜索图像的docker-compose.yml文件:
elasticsearch:
image: elasticsearch
ports:
- "9200:9200"
container_name: custom_elasticsearch_1
Run Code Online (Sandbox Code Playgroud)
如果我想安装其他插件,如HQ接口或附件映射器,我必须使用以下命令进行手动安装:
$ docker exec custom_elasticsearch_1 plugin install royrusso/elasticsearch-HQ
$ docker exec custom_elasticsearch_1 plugin install mapper-attachments
Run Code Online (Sandbox Code Playgroud)
有没有办法在我运行docker-compose up命令时自动安装它们?
我正在使用Python进行弹性测试.我的代码看起来像这样: -
from elasticsearch import Elasticsearch
if __name__ == '__main__':
index="IndexPosition"
es=Elasticsearch(['https://localhost:8080'])
res = es.search(index='{0}'.format(index), doc_type="log",size=1000, from_=0, body={ "query": {
"match": {
...Match condition
}
}
Run Code Online (Sandbox Code Playgroud)
}})
现在,由于体系结构的变化,弹性搜索中添加了用户身份验证.让我们假设用户名 - 用户和密码 - 通过.如何在查询中传递用户名和密码..?
python python-2.7 elasticsearch elasticsearch-plugin elasticsearch-2.0
由于这些限制,我不允许从互联网上安装任何软件包.所以,这个命令对我来说对安装搜索防范没有用.
bin/elasticsearch-plugin install -b com.floragunn:search-guard-ssl:<version>
Run Code Online (Sandbox Code Playgroud)
但是,我可以通过运行上面的命令在不同的网络上成功安装Search Guard.
由于这个原因,我尝试根据文档通过以下命令从tar.gz或zip文件安装Search Guard .
/usr/share/elasticsearch# bin/elasticsearch-plugin install file:///home/xxxx/xxxx/search-guard-5-5.2.0-10-sgadmin-standalone.zip
Run Code Online (Sandbox Code Playgroud)
这个失败,出现以下错误.
-> Downloading file:///home/xxx/xxxx/search-guard-5-5.2.0-10- sgadmin-standalone.zip
[=================================================] 100%
ERROR: `elasticsearch` directory is missing in the plugin zip
Run Code Online (Sandbox Code Playgroud)
我下载的zip/tar.gz的从这个搜索gaurd的Maven仓库.
是否有人也面临同样的问题.如果没有,请帮助解决这个问题.
elasticsearch elasticsearch-plugin elastic-stack elasticsearch-5
我需要的很简单,但我无法在 Elasticsearch 中找到如何去做,可能是因为需要完成的工作很复杂。
输入(两个示例 JSON 文档)
{ "car" : 150, "bike" : 300 }
{ "car" : 100, "bike" : 200}
Run Code Online (Sandbox Code Playgroud)
我想要的回报是,当我触发搜索查询时,它会返回带有额外字段的文档,该字段inventory定义为汽车和自行车数量的总和。并按排序顺序。
示例输出:
hits: [
{ "car" : 150, "bike" : 300, "inventory": 450},
{ "car" : 100, "bike" : 200, "inventory": 300}
]
Run Code Online (Sandbox Code Playgroud)
在elasticsearch中可以做这样的事情吗?(我假设使用动态脚本)
elasticsearch elasticsearch-plugin pyelasticsearch elasticsearch-jdbc-river spring-data-elasticsearch
我有一个查询provider_id要从Elastic Search Cluster. 我正在使用以下查询来获取单个结果, provider_id但需要帮助确定如何传递提供者列表。
{
"query": {
"bool": {
"must": [{
"match": {
"message.provider_id": {
"query": 943523,
"type": "phrase"
}
}
}]
}
}
}
Run Code Online (Sandbox Code Playgroud)
假设我想搜索provider_ids = [913523, 923523, 923523, 933523, 953523]那么我应该如何修改查询?
我已经在Ubuntu 14.04中安装了Elasticsearch 5.1。我在Elasticsearch中执行了一些操作,例如创建索引,删除索引等。然后,我安装了Kibana 5.1。现在,我想使用邮递员(使用PUT的localhost:9200 / my_index)在elasticsearch中创建新索引。但是我遇到了这个错误。
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "unknown setting [index.country] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type": "illegal_argument_exception",
"reason": "unknown setting [index.country] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
我记得我曾经用作country索引或类型。但是后来我清除了elasticsearch和kibana(也删除了与之相关的目录)。都重新安装。但是仍然出现此错误。如果有人知道解决方案,将不胜感激。
这是一些您可能需要解决的查询的输出。
GET localhost:9200 / _mapping
{“ .kibana”:{“映射”:{“服务器”:{“属性”:{“ uuid”:{“类型”:“关键字”}}}},“ config”:{“属性”:{“ buildNum “:{” type“:”关键字“}}}}}}
(获取)localhost:9200 …
elasticsearch elasticsearch-plugin elasticsearch-indices elasticsearch-5
我必须使用Elasticsearch摄取插件在 pdf 文档中实现基于全文的搜索。当我尝试someword在 pdf 文档中搜索单词时,我得到了一个空的命中数组。
//Code for creating pipeline
PUT _ingest/pipeline/attachment
{
"description" : "Extract attachment information",
"processors" : [
{
"attachment" : {
"field" : "data",
"indexed_chars" : -1
}
}
]
}
//Code for creating the index
PUT my_index/my_type/my_id?pipeline=attachment
{
"filename" : "C:\\Users\\myname\\Desktop\\bh1.pdf",
"title" : "Quick",
"data": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0="
}
//Code for searching the word in pdf
GET /my_index/my_type/_search
{
"query": {
"match": {
"data" : {
"query" : "someword"
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在实施一个项目,在该项目中,结果将根据分数进行排序,并且在分数相同的情况下,结果集将根据日期字段进行排序。当分数相差 0.00001,即小数点的第 5 位或第 6 位时,就会出现问题。有什么方法可以将 Elasticsearch 中得出的分数四舍五入到小数点后第 4 位,以便二级排序可以对其进行处理。如果没有任何解决方法可以实现这一点。
谢谢阿希特
我按照这个网址安装 Elastalert,但是我什至不知道 config.yaml.example 文件位于哪里。elastalert 默认安装在哪里?我错过了什么吗?