在我的一个项目中,我计划将ElasticSearch与mysql一起使用.我已经成功安装了ElasticSearch.我能够分别管理ES中的索引.但我不知道如何用mysql实现相同的功能.
我已阅读了几份文件,但我有点困惑,没有明确的想法.谁能帮帮我吗?
提前致谢.
ElasticSearch 5.x对Suggester API(文档)引入了一些(重大)更改.最值得注意的变化如下:
完成建议是面向文档的
建议知道他们所属的文件.现在,关联的文档(
_source)将作为完成建议的一部分返回.
简而言之,所有完成查询都返回所有匹配的文档而不是匹配的单词.这就是问题所在 - 如果自动填充的单词出现在多个文档中,则会重复这些单词.
假设我们有这个简单的映射:
{
"my-index": {
"mappings": {
"users": {
"properties": {
"firstName": {
"type": "text"
},
"lastName": {
"type": "text"
},
"suggest": {
"type": "completion",
"analyzer": "simple"
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
有一些测试文件:
{
"_index": "my-index",
"_type": "users",
"_id": "1",
"_source": {
"firstName": "John",
"lastName": "Doe",
"suggest": [
{
"input": [
"John",
"Doe"
]
}
]
}
},
{
"_index": "my-index",
"_type": "users",
"_id": …Run Code Online (Sandbox Code Playgroud) 我的代码在elasticsearch 5中工作得很好但是当我从5升级到6然后.它正在显示
org.elasticsearch.common.transport.InetSocketTransportAddress not found
Run Code Online (Sandbox Code Playgroud)
完整的堆栈跟踪:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project elastic-store: Compilation failure
[ERROR] /home/elastic/elastic-store/src/main/java/com/qw/psence/store/es/common/ESClient.java:[12,42] cannot find symbol
[ERROR] symbol: class InetSocketTransportAddress
[ERROR] location: package org.elasticsearch.common.transport
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles: …Run Code Online (Sandbox Code Playgroud) 当我尝试在elasticsearch中存储任何内容时,错误说:
TransportError(403, u'cluster_block_exception', u'blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];')
Run Code Online (Sandbox Code Playgroud)
我已经在索引中插入了大约2亿个文档.但我不知道为什么会发生这种错误.我试过了:
curl -u elastic:changeme -XPUT 'localhost:9200/_cluster/settings' -H 'Content-Type: application/json' -d '{"persistent":{"cluster.blocks.read_only":false}}'
Run Code Online (Sandbox Code Playgroud)
如上所述: ElasticSearch进入"只读"模式,节点无法更改
结果是:
{"acknowledged":true,"persistent":{"cluster":{"blocks":{"read_only":"false"}}},"transient":{}}
Run Code Online (Sandbox Code Playgroud)
但没有改变.我该怎么办?
Elasticsearch 是否允许我们查询不区分大小写的文档?或者我应该在查询之前将它们保存为不区分大小写?或者是否应该为整个索引设置一些设置以使其不区分大小写?
你能澄清一下这一刻吗?
我正在查看ElasticSearch 5.6上的单一类型索引的示例,以准备删除映射类型.具体来说,我正在运行ElasticSearch 页面中关于删除类型的第一个示例,在使用docker.elastic.co/elasticsearch/elasticsearch:5.6.5映像在Docker中本地运行的新集群上
运行我链接到的第一部分的第一个例子:
PUT localhost:9200/users
{
"settings": {
"index.mapping.single_type": true
},
"mappings": {
"_doc": {
"properties": {
"name": {
"type": "text"
},
"user_name": {
"type": "keyword"
},
"email": {
"type": "keyword"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
{
"error": {
"root_cause": [
{
"type": "invalid_type_name_exception",
"reason": "mapping type name [_doc] can't start with '_'"
}
],
"type": "invalid_type_name_exception",
"reason": "mapping type name [_doc] can't start with '_'"
},
"status": 400
}
Run Code Online (Sandbox Code Playgroud)
我知道名称中带有前导下划线的字段通常被认为是为ES内部保留的; 但我假设这_doc将被视为一个从版本开始的特殊情况5.6 …
有人可以提供python elasticsearch助手客户端的扫描API示例吗?
res = elasticsearch.helpers.scan(....)
如何从res对象获得elasticsearch的所有结果?
我想得到满足一定条件的群体数量.在SQL术语中,我想在Elasticsearch中执行以下操作.
SELECT COUNT(*) FROM
(
SELECT
senderResellerId,
SUM(requestAmountValue) AS t_amount
FROM
transactions
GROUP BY
senderResellerId
HAVING
t_amount > 10000 ) AS dum;
Run Code Online (Sandbox Code Playgroud)
到目前为止,我可以通过term Aggsel对senderResellerId进行分组.但是当我应用过滤器时,它不能按预期工作.
弹性请求
{
"aggregations": {
"reseller_sale_sum": {
"aggs": {
"sales": {
"aggregations": {
"reseller_sale": {
"sum": {
"field": "requestAmountValue"
}
}
},
"filter": {
"range": {
"reseller_sale": {
"gte": 10000
}
}
}
}
},
"terms": {
"field": "senderResellerId",
"order": {
"sales>reseller_sale": "desc"
},
"size": 5
}
}
},
"ext": {},
"query": { "match_all": {} },
"size": …Run Code Online (Sandbox Code Playgroud) 我最近升级到elasticsearch版本6.1.1,现在我无法批量索引json文件中的文档.我内联它,它工作正常.以下是该文件的内容:
{"index" : {}}
{"name": "Carlson Barnes", "age": 34}
{"index":{}}
{"name": "Sheppard Stein","age": 39}
{"index":{}}
{"name": "Nixon Singleton","age": 36}
{"index":{}}
{"name": "Sharron Sosa","age": 33}
{"index":{}}
{"name": "Kendra Cabrera","age": 24}
{"index":{}}
{"name": "Young Robinson","age": 20}
Run Code Online (Sandbox Code Playgroud)
当我运行此命令时,
curl -XPUT 'localhost:9200/subscribers/ppl/_bulk?pretty' -H 'Content-Type: application/json' -d @customers_full.json
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "The bulk request must be terminated by a newline [\n]"
}
],
"type" : "illegal_argument_exception",
"reason" : "The bulk request must be terminated by …Run Code Online (Sandbox Code Playgroud) 有人能告诉我ElasticSearch上是否有相同的Solr copyField指令?
我知道有多字段类型: http ://www.elasticsearch.org/guide/reference/mapping/multi-field-type.html当你想在同一个字段上应用多个分析器时,这很好.
但它并不完全相同.Solr允许将多个字段"合并"为一个:
<field name="id" type="string" indexed="true" stored="true"/>
<field name="name" type="string" indexed="true" stored="true"/>
<field name="subject" type="string" indexed="true" stored="true"/>
<field name="location" type="string" indexed="true" stored="true"/>
<field name="all" type="text" indexed="true" stored="true" multiValued="true"/>
<copyField source="*" dest="all"/>
Run Code Online (Sandbox Code Playgroud)
这个插件很有前途:https: //github.com/yakaz/elasticsearch-analysis-combo
因为它允许在使用ElasticSearch多值字段时将结果作为单个字段返回.但它仍然不完全相同,因为它不允许"合并"多个字段.
我想要Combo分析器和Solr copyField的组合.
我有一个博客文章模型(标题/描述字段),并希望在单个字段"blogContent"上复制标题和描述,我将在其中应用2个不同的分析器.
ElasticSearch有解决方案吗?
elasticsearch ×10
elasticsearch-5 ×10
autocomplete ×1
bulk-load ×1
duplicates ×1
json ×1
logstash ×1
lucene ×1
mysql ×1
python ×1
python-2.7 ×1
search ×1
solr ×1