目前令我困惑的是,在查询中我添加了category_id10 的提升,这比其他提升要高得多.来自另一个类别"Tai Chi"的项目以某种方式到达结果的顶部.
我有一个映射:
{
"the_items": {
"item": {
"properties": {
"brand_id": {
"type": "integer"
},
"category_id": {
"type": "integer"
},
"description": {
"type": "multi_field",
"fields": {
"description": {
"type": "string",
"analyzer": "full_title"
}
}
},
"title": {
"type": "multi_field",
"fields": {
"title": {
"type": "string",
"analyzer": "full_title"
},
"partial_title": {
"type": "string",
"index_analyzer": "partial_title",
"search_analyzer": "full_title",
"include_in_all": false
}
}
},
"updated_at": {
"type": "string"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我正在运行以下查询:
curl -XGET 'http://localhost:9200/austin_items/_search?pretty=true' -d '{
"query": …Run Code Online (Sandbox Code Playgroud) 所以我有一个字段存储格式的值:number/year,如23/2014,24/2014,12/2015等等......
因此,如果此字段被映射为not_analyzed一个,我可以使用术语过滤器进行精确值搜索,如果我搜索该精确结构中的值(类似于1/2014,15/2014,...)它可以工作,就像sql equals(=).
{
"query": {
"filtered": {
"filter": {
"term": {
"processNumber": "11/2014"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
因此,使用11 /或/ 2014之类的不同内容进行搜索将不会返回匹配.这可以.
但是,如果我将字段定义为not_analyzed,我不能sql LIKE使用match_phrase查询进行类型搜索.
{
"query": {
"match_phrase": {
"processNumber": "11/201"
}
}
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,搜索11,11 /,/ 2014或2014应返回命中,但它们不会.问题是,如果字段未映射为一个字段,则此查询有效not_analyzed.所以我似乎要么使用其中一个,问题是该字段应该支持不同查询的两个选项,我在这里遗漏了什么?
我有一个使用 core 6.0 的类库
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
我想在核心 6.0 框架项目或 WPF NET 4.8 框架中使用此库。所以实际上,我无法在用 Net 4.8 编写的项目中引用库 core 6
我想在两个环境中使用相同的库(相同的源代码),我如何解决我的问题,是否可以为相同的源代码使用不同的配置框架?
我正在尝试使用elasticsearch和Kibana进行logstash.我有所有最新版本,但在遇到一些问题之后,我意识到我需要安装一个旧版本,即0.20.6的elasticsearch,以便它能够与最新版本的logstash一起正常工作.因此,我下载了旧版本,执行了旧版本rm -rf(v.0.90.x)并安装了新版本(v.0.20.6).我试着启动它.它开始,但然后给我重复错误,如:
[2013-07-29 14:24:04,718][WARN ][indices.cluster ] [Dansen Macabre] [blog][2] failed to start shard
org.elasticsearch.indices.recovery.RecoveryFailedException: [blog][2]: Recovery failed from [Blob][UCFJzrBxQHOYOohF6scQMw][inet[/10.1.10.52:9300]] into [Dansen Macabre][-GzBNHLJSc2Do5DNTsn1jw][inet[/10.1.10.52:9301]]
at org.elasticsearch.indices.recovery.RecoveryTarget.doRecovery(RecoveryTarget.java:293)
at org.elasticsearch.indices.recovery.RecoveryTarget.access$300(RecoveryTarget.java:62)
at org.elasticsearch.indices.recovery.RecoveryTarget$2.run(RecoveryTarget.java:163)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.elasticsearch.transport.RemoteTransportException: [Blob][inet[/10.1.10.52:9300]][index/shard/recovery/startRecovery]
Caused by: org.elasticsearch.index.engine.RecoveryEngineException: [blog][2] Phase[1] Execution failed
at org.elasticsearch.index.engine.robin.RobinEngine.recover(RobinEngine.java:1123)
at org.elasticsearch.index.shard.service.InternalIndexShard.recover(InternalIndexShard.java:526)
at org.elasticsearch.indices.recovery.RecoverySource.recover(RecoverySource.java:116)
at org.elasticsearch.indices.recovery.RecoverySource.access$1600(RecoverySource.java:60)
at org.elasticsearch.indices.recovery.RecoverySource$StartRecoveryTransportRequestHandler.messageReceived(RecoverySource.java:328)
at org.elasticsearch.indices.recovery.RecoverySource$StartRecoveryTransportRequestHandler.messageReceived(RecoverySource.java:314)
at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.elasticsearch.indices.recovery.RecoverFilesRecoveryException: [blog][2] Failed to transfer [25] files with total size of …Run Code Online (Sandbox Code Playgroud) 我正在努力将FLT应用到我正在构建的原型ES系统中.我已经查看了Elasticsearch网站上的文档,虽然它已经存在,但我似乎无法实现这一点.也许有人可以给我一些关于如何做到这一点的见解.
我似乎无法在网络上的其他地方找到任何这方面的例子,但也许我的谷歌技能今天没有达到标准.这是我到目前为止设法建造的 -
$ curl -XGET 'http://127.0.0.1:9200/uber/uber/_search?' -d '{
"fuzzy_like_this": {
"fields": [
"pty_firstname",
"pty_surname"
],
"like_text": "Nathan Andew",
"max_query_terms": 12
}
}'
Run Code Online (Sandbox Code Playgroud)
以下是我在发送请求时从提示中收到的错误消息 -
{
"error":"SearchPhaseExecutionException[Failed to execute phase [query], total failure;
shardFailures {[u9HfJxbXRn-8ml19FKBTiA][uber][2]: SearchParseException[[uber][2]: from[-1],size[-1]:
Parse Failure [Failed to parse source [
{
"fuzzy_like_this": {
"fields": [
"pty_firstname",
"pty_surname"
],
"like_text": "Nathan Andew",
"max_query_terms": 12
}
}
]]]; nested: SearchParseException[[uber][2]: from[-1],size[-1]:
Parse Failure [No parser for element [fuzzy_like_this]]]; }{[u9HfJxbXRn-8ml19FKBTiA][uber][0]:
SearchParseException[[uber][0]: from[-1],size[-1]:
Parse Failure [Failed to parse source [ …Run Code Online (Sandbox Code Playgroud) 当我通过我的ElasticSearch服务器设置
curl -XGET localhost:9200/_cluster/settings
Run Code Online (Sandbox Code Playgroud)
我看到持久和瞬态的设置.
{
"persistent": {
"cluster.routing.allocation.cluster_concurrent_rebalance": "0",
"threadpool.index.size": "20",
"threadpool.search.size": "30",
"cluster.routing.allocation.disable_allocation": "false",
"threadpool.bulk.size": "40"
},
"transient": {}
}
Run Code Online (Sandbox Code Playgroud)
如果我设置了持久性设置,它不会将其保存到我的config/elasticsearch.yml配置文件中?所以我的问题是当我的服务器重新启动时,它如何知道我的持久设置是什么?
不要告诉我不要担心它,因为我几乎丢失了我的整个集群数据,因为它在重新启动后获取了我的配置文件中的所有设置,而不是上面显示的持久设置:)
我正在尝试通过手动将值传递给构造函数来创建一个虚拟的SearchResponse对象.我有一个JUnit测试类,我正在使用这个虚拟值来模拟实际的方法调用.尝试使用以下方法
public SearchResponse actionGet() throws ElasticsearchException {
ShardSearchFailure[] shardFailures = new ShardSearchFailure[0];
int docId = 0;
String id = "5YmRf-6OTvelt29V5dphmw";
Map<String, SearchHitField> fields = null;
InternalSearchHit internalSearchHit = new InternalSearchHit(docId, id,
null, fields);
InternalSearchHit[] internalSearchHit1 = { internalSearchHit };
InternalSearchResponse EMPTY = new InternalSearchResponse(
new InternalSearchHits(internalSearchHit1, 0, 0), null, null,
null, false);
SearchResponse searchResponse = new SearchResponse(EMPTY, "scrollId",
1, 1, 1000, shardFailures);
return searchResponse;
}
Run Code Online (Sandbox Code Playgroud)
这是我直接查询elasticsearch时json的实际值.
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"failed": 0
}, …Run Code Online (Sandbox Code Playgroud) 我正在努力让ElasticSearch工作,特别是使用River Plugin.出于某种原因,我无法让它发挥作用.我已经包含了我正在尝试使用的程序,在此处找到:
curl -XDELETE 'http://localhost:9200/_all/'
Run Code Online (Sandbox Code Playgroud)
响应:
{
"ok": true,
"acknowledged": true
}
Run Code Online (Sandbox Code Playgroud)
这是我知道我正在使用一组空的elasticsearch实例.
我有一个名为test的现有数据库,并且已经安装了河流插件.无论如何都要测试确认River Plugin已安装并正在运行?
我发出以下命令:
curl -XPUT 'http://localhost:9200/_river/my_index/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_couch_db",
"filter" : null
}
}'
Run Code Online (Sandbox Code Playgroud)
my_couch_db是一个真正的数据库,我在Futon中看到它.里面有一份文件.
响应:
{
"ok": true,
"_index": "_river",
"_type": "my_index",
"_id": "_meta",
"_version": 1
}
Run Code Online (Sandbox Code Playgroud)
现在在这一点上,我的理解是弹性应该像我在教程中看到的那样工作.
我试着查询,只是为了找到任何东西.我去
http://localhost:9200/my_couch_db/my_couch_db.
Run Code Online (Sandbox Code Playgroud)
响应:
No handler found for uri [/my_couch_db/my_couch_db] and method [GET]
Run Code Online (Sandbox Code Playgroud)
我去的时候有点奇怪
localhost:5984/my_couch_db/__changes
Run Code Online (Sandbox Code Playgroud)
我明白了
{
"error": "not_found",
"reason": "missing"
}
Run Code Online (Sandbox Code Playgroud)
任何人都知道我搞砸了哪一部分?
我试图导入Logstash的日志文件包含一个有时看起来像日期/时间的字段,有时却没有.不幸的是,第一次出现看起来像日期/时间,某人(logstash或elasticsearch)决定将该字段定义为日期/时间.尝试导入以后的日志记录时,Elasticsearch有一个例外:
Failed to execute [index ...]
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse [@fields.field99]
at org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:320)
at org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:587)
...
Caused by: java.lang.IllegalArgumentException: Invalid format: "empty"
at org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:747)
...
Run Code Online (Sandbox Code Playgroud)
问题:如何告诉logstash/elasticsearch不将此字段定义为日期/时间?我希望我的日志中的所有字段(除了一个显式时间戳字段)都被定义为文本.
问题:似乎logstash在看到弹性搜索引发异常的日志之后放弃尝试从日志文件中导入记录.如何告诉logstash忽略此异常并继续尝试从日志文件中导入其他记录?
我使用以下内容列出索引
curl localhost:9200/_cat/indices?v
Run Code Online (Sandbox Code Playgroud)
是否有任何方法可以过滤或查询索引名称,例如使用通配符?
curl localhost:9200/_cat/indices - d '{
"query": {
"prefix": {
"index": "sam-"
}
}
}'
Run Code Online (Sandbox Code Playgroud)
elasticsearch.js中的格式是什么?