ElasticSearch

Can I use spannear in the nested field for different block in elasticsearch?

心不动则不痛 提交于 2021-02-11 13:01:44
问题 The document is like: doc = { "id": 1, "content": [ { "txt": I, "time": 0, }, { "txt": have bla bla, "time": 1, }, { "txt": bla bla book, "time": 2, }, { "txt": do not match this block, "time": 3, }, ] } And the search query is like: "span_near": { "clauses": [ {"span_term": {"content.txt": "I"}}, {"span_term": {"content.txt": "book"}}, ], "slop": 5, "in_order": False, } And I want to return "content.time": [0,1,2] Now, I know by using the nested field, the "content.time" can be retrieved,

Sync MongoDb to ElasticSearch

纵饮孤独 提交于 2021-02-11 12:52:23
问题 I am looking for a way to sync collections in MongoDB with Elastic Search (ES). The goal is to have MongoDB as a primary data source and use MongoDB as a full text search engine. (The business logic of my project is written in python). Several approaches are online available. Mongo-connect River plugin logstash-input-mongodb (logstash plugin) see similar question Transporter However, most of the suggestions are several years old and I could not find any solution that supports the current

Logstash can not connect to Elastic search

末鹿安然 提交于 2021-02-11 12:49:53
问题 {:timestamp=>"2017-07-19T15:56:36.517000+0530", :message=>"Attempted to send a bulk request to Elasticsearch configured at '[\"http://localhost:9200\"]', but Elasticsearch appears to be unreachable or down!", :error_message=>"Connection refused (Connection refused)", :class=>"Manticore::SocketException", :level=>:error} {:timestamp=>"2017-07-19T15:56:37.761000+0530", :message=>"Connection refused (Connection refused)", :class=>"Manticore::SocketException", :backtrace=>["/opt/logstash/vendor

How to use standard search analyzer with keyword mapping?

若如初见. 提交于 2021-02-11 12:30:03
问题 I have to use search_analyzer not with text but with type keyword as below: "properties":{ "email" : { "type" : "keyword", "analzer":"autocomplete", "search_analyzer":"standard" } } But actually I have below mappping: "properties":{ "email" : { "type" : "keyword", } } 回答1: Analyzers only work with type text , not keyword . So you cannot define a search_analyzer on a keyword field. However, what you can do is to create a sub-field of type text like this: PUT your-index/_mapping { "properties":

Skip duplicates on field in a Elasticsearch search result

☆樱花仙子☆ 提交于 2021-02-11 12:29:31
问题 Is it possible to remove duplicates on a given field? For example the following query: { "query": { "term": { "name_admin": { "value": "nike" } } }, "_source": [ "name_admin", "parent_sku", "sku" ], "size": 2 } is retrieving "hits" : [ { "_index" : "product", "_type" : "_doc", "_id" : "central30603", "_score" : 4.596813, "_source" : { "parent_sku" : "SSP57", "sku" : "SSP57816401", "name_admin" : "NIKE U NSW PRO CAP NIKE AIR" } }, { "_index" : "product", "_type" : "_doc", "_id" :

ES Client

穿精又带淫゛_ 提交于 2021-02-11 10:45:05
关于 ElasticSearch的学习参见: ELK | wjcx_sqh 本文分别学习 .Net | Java 下操作 ES: .Net 目前主流的 .Net 客户端有 2 种: PlainElastic.Net Elasticsearch.Net.dll 和 Nest.dll PlainElastic.Net 简单了解即可,具体参见: https://www.cnblogs.com/eggTwo/p/4039779.html ##Elasticsearch.Net + Nest 直接在 Nuget | 官网 下载对应的 .nuget包,在项目中引入即可。 Elasticsearch.Net 6.8.0 NEST 6.8.0 注意不同版本 .dll 对 .Net Framework 框架的依赖。 ###索引 创建连接和索引 var nodes = new Uri[] { new Uri(""), new Uri("") }; var pool = new StaticConnectionPool(nodes); var settings = new ConnectionSettings(pool); var ESClient = new ElasticClient(settings); if (!client.TypeExists(_indexName, _typeName)

写给大忙人的ELK最新版6.2.4学习笔记-Logstash和Filebeat解析(java异常堆栈下多行日志配置支持)

大憨熊 提交于 2021-02-11 10:33:39
写给大忙人的ELK最新版6.2.4学习笔记-Logstash和Filebeat解析(java异常堆栈下多行日志配置支持) 参考文章: (1)写给大忙人的ELK最新版6.2.4学习笔记-Logstash和Filebeat解析(java异常堆栈下多行日志配置支持) (2)https://www.cnblogs.com/zhjh256/p/9145193.html 备忘一下。 来源: oschina 链接: https://my.oschina.net/u/4432649/blog/4863334

How to select the last bucket in a date_histogram selector in Elasticsearch

萝らか妹 提交于 2021-02-11 07:10:01
问题 I have a date_histogram and I can use max_bucket to get the bucket with the greatest value, but I want to select the last bucket (i.e. the bucket with the highest timestamp). Using max_bucket to get the greatest value works OK, but I don't know what to put in the buckets_path to get the last bucket. My mapping: { "ee-2020-02-28" : { "mappings" : { "dynamic" : "strict", "properties" : { "date" : { "type" : "date" }, "frequency" : { "type" : "long" }, "keyword" : { "type" : "keyword" }, "text"

How to select the last bucket in a date_histogram selector in Elasticsearch

大兔子大兔子 提交于 2021-02-11 07:08:24
问题 I have a date_histogram and I can use max_bucket to get the bucket with the greatest value, but I want to select the last bucket (i.e. the bucket with the highest timestamp). Using max_bucket to get the greatest value works OK, but I don't know what to put in the buckets_path to get the last bucket. My mapping: { "ee-2020-02-28" : { "mappings" : { "dynamic" : "strict", "properties" : { "date" : { "type" : "date" }, "frequency" : { "type" : "long" }, "keyword" : { "type" : "keyword" }, "text"

ElasticSearch-head 操作时,报 406错误码

十年热恋 提交于 2021-02-11 07:06:53
查询时报错{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406} 解决方法: 1、进入head安装目录;docker exec -it 名称 bash 2、打开文件夹_site,cd _site/ 3、编辑vendor.js 共有两处   ①. 6886行 contentType: "application/x-www-form-urlencoded     改成     contentType: "application/json;charset=UTF-8"   ②. 7574行 var inspectData = s.contentType === "application/x-www-form-urlencoded" &&     改成    var inspectData = s.contentType === "application/json;charset=UTF-8" && 4、退出容器exit 然后重启 5、重新查询,可以查出数据 来源: oschina 链接: https://my.oschina.net/u/4258573/blog/3327635