Elasticsearch系列初识搜索
概要本篇主要介绍搜索的报文结构含义、搜索超时时间的处理过程,提及了一下多索引搜索和轻量搜索,最后将精确搜索与全文搜索做了简单的对比。空搜索搜索API最简单的形式是不指定索引和类型的空搜索,它将返回集群下所有索引的所有文档(默认显示10条):GET /_search响应的结果示例(有筛选...
2024-01-10Elasticsearch:获取索引列表
是否可以获得与特定模式匹配的索引列表,例如这是获取索引列表的方法:curl -XGET 'localhost:9200/_stats/'但是我找不到过滤它们的方法,因此该列表仅包含匹配“ my_index_nr_1 ”的索引,其中“ ”是通配符解在使用ES一段时间后,这里是我现在使用的东西,希望它能对其他人有所帮助:curl -XGET '/_cat/indi...
2024-01-10在Elasticsearch中按日期过滤
我正在尝试搜索日期范围内的日期范围内的所有项目,但失败(不返回任何结果)查询:{ "query": { "filtered": { "query": { "match_all": {} }, "filter": { "range": { "last_updated": { "from": "2013-01-01 00:00:00" } } } } }}映...
2024-01-10在Elasticsearch中存储日期格式
我想在Elasticsearch中添加一个日期时间字符串时遇到问题。该文件如下:{"LastUpdate" : "2013/07/24 00:00:00"}该文档提出了一个错误 "NumberFormatException" [For input string: \"20130724 00:00:00\"]我知道我可以在Elasticsearch中使用日期格式,但是即使阅读网站上的文档,我也不知道如何使用。{"LastUpdate": { "properties": { ...
2024-01-10Elasticsearch入门功能特点介绍
功能1. 分布式的搜索引擎和数据分析引擎搜索引擎: 比如我们常用的百度,以及其他网站的站内搜索,文献检索。数据分析: 各大电商网站,比如某宝,某东,他们会分析最近几天某种商品销量排名,还有一些新闻网站,最近 1 个月访问量排名前 3 的新闻版块是哪些。2. 全文检索,结构化检索,数...
2024-01-10Elasticsearch-使用通配符搜索
我已经使用此批量请求设法用4个文档填充了索引:开机自检 localhost:9200/titles/movies/_bulk{"index":{"_id":"1"}}{"id": "1","level": "first","titles": [{"value": "The Bad and the Beautiful","type": "Catalogue","main": true},{"value": "The Bad and the Beautiful (1945)","type": "Internat...
2024-01-10Elasticsearch过滤查询与过滤器
“过滤后的查询和过滤器”与“根查询和过滤器”之间有什么区别吗?例如情况1:{ "query":{ "filtered":{ "query":{ "term":{"title":"kitchen3"} }, "filter":{ "term":{"price":1000} } } }}情况2:{ "query":{ "term":{"title":"kitchen3"} }, "filter":{ "term...
2024-01-10ElasticSearch中的多个节点
ElasticSearch中如何有多个节点?我在elasticsearch.yml中使用以下内容,但只有最后一个节点启动,浏览器抱怨:The pageat file://localhost/ says: undefined。node.name: "No Data"node.master: truenode.data: falsenode.name: "Data One"node.master: falsenode.data: truenode.name: "Data Two"node.master: fal...
2024-01-10如何修复Elasticsearch中超时的读取
我使用Elasticsearch-1.1.0为推文编制了索引。索引过程可以。然后我升级了版本。现在我使用Elasticsearch-1.3.2,并且我随机收到此消息:Exception happened: Error raised when there was an exception while talking to ES.ConnectionError(HTTPConnectionPool(host='127.0.0.1', port=8001): Read timed out. (read timeo...
2024-01-10在Elasticsearch中增加队列的大小?
我一直在查看我的elasticsearch日志,但遇到了错误rejected execution (queue capacity 1000) onorg.elasticsearch.search.action.SearchServiceTransportAction$23@6d32fa18查找错误后,普遍的共识是增加队列的大小,如此处所述-https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.ht...
2024-01-10Elasticsearch按日期范围进行分组计数
我有这样的文件:{body: 'some text',read_date: '2017-12-22T10:19:40.223000'}是否可以按日期查询最近10天发布的文档数量?例如:2017-12-22, 150 2017-12-21, 79 2017-12-20, 111 2017-12-19, 27 2017-12-18, 100回答:是的,您可以使用date_histogram聚合轻松实现这一点,如下所示:{ "query": { "range": { "read_date...
2024-01-10Elasticsearch聚合排名(按热门得分)
我想按top_hit的doc.score订购存储桶。我当前的实现如下。 group_by_iid: { terms: { field: 'iid', order: { max_score: 'desc' }, size: 0 }, aggs: { max_score: { max: { script: 'doc.score' } }, top_hit: { top_hits: { sort: [{ sour...
2024-01-10在哪里关闭Elasticsearch客户端连接?
我应该在哪里关闭与Elasticsearch客户端的连接?我正在使用Spring,并且我不想使用Elasticsearch集成,因为我想学习如何首先完成它。应该只为该应用程序创建一个客户端吗?意味着它将具有单例范围?还是应该具有原型范围并为每次交互关闭连接?回答:您应该为每个应用程序使用一个客户端,使其成为...
2024-01-10ElasticSearch和Java环境变量
对于Windows 7,我已经安装了32位和64位版本的JDK。所有四个安装的版本均为8,更新为20。http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html当我下载并解压缩elasticsearch并运行/bin/service.bat或/bin/elasticsearch.bat文件时,我进入了终端:JAVA_HOME environment variable must be set! Pres...
2024-01-10ElasticSearch设置用户名密码访问
版本号:7.3.11.需要在配置文件中开启x-pack验证, 修改config目录下面的elasticsearch.yml文件,在里面添加如下内容,并重启.xpack.security.enabled: truexpack.license.self_generated.type: basicxpack.security.transport.ssl.enabled: true 2,执行设置用户名和密码的命令,这里需要为4个用户分别设置密码,elastic, kibana, logstash_system,...
2024-01-10在Elasticsearch中搜索具有相同值的文档
我有一个看起来像这样的架构:{ "mappings": { "entity": { "properties": { "a": { "type": "text" }, "b": { "type": "text" } } }我想找到b的所有值,其中b的值由2个或更多实体共享:查询依据:[{"a": "a1", "b": "b1"}, {"a": "a1", "b": "b2"}, {"a": "a2", "b": ...
2024-01-10[Elasticsearch]ES更新问题踩坑记录
问题描述我们有个系统设计的时候针对Hive创建表、删除表, 需要更新ES中的一个状态,标记是否删除,在几乎同时执行两条下面的语句的时候,发现在ES 中出现表即使被创建了还是无法被查询到的情况,针对该问题记录下排查分析过程.drop table if exists tmp.test_create_table;create table if not exists tmp.test_create_table(id...
2024-01-10Elasticsearch-如果词频较高,则得分较高
我有2个文档,并且正在搜索关键字“ Twitter”。假设两个文档都是带有“标签”字段的博客文章。文档A在“标签”字段中只有1个术语,即“ Twitter”。文档B在“标签”字段中有100个术语,但其中3个是“ Twitter”。即使文档B的出现频率较高,“elasticsearch”也会给文档A更高的分数。但是该分数是“稀释...
2024-01-10HBase数据同步到ElasticSearch的方案
<div id="article_content" class="article_content"><p><br> </p> <h3>ElasticSearch的River机制</h3> <p>ElasticSearch自身提供了一个River机制,用于同步数据。</p> <p>这里能够找到官方眼下推荐的River:</p> <p><a target="_blank" href="http://www.elasticsearch.org/guide/en/elasticsearch/rivers/curre...
2024-01-10Elasticsearch_exporter监控指标
github地址:https://github.com/justwatchcom/elasticsearch_exporterNameTypeCardinalityHelpelasticsearch_breakers_estimated_size_bytesgauge4Estimated size in bytes of breakerbreaker字节的估计大小elasticsearch_breakers_limit_size_bytesgauge4Limit size in bytes for brea...
2024-01-10如何在NEST2中更新Elasticsearch文档
我已将代码移植到NEST 2.0和Elasticsearch 2.0我需要找到一种方法来更新已经存储在ES2中的文档我正在使用部分对象技术: elastic.Update<myDocumentType, myPartialDocumentType>(u => u .Index(myIndexName) .Id(id) .Doc( new myPartialDocumentType() ...
2024-01-10Elastic search DSL:用通配符过滤吗?
我正在尝试使用术语过滤器过滤文档。我不确定如何在过滤器中引入通配符。我尝试过这样的事情:"filter":{ "bool":{ "must":{ "terms":{ "wildcard" : { "aircraft":[ "a380*" ] } } } }}但是我得到了SearchParseExcept...
2024-01-10ElasticSearch仅查询嵌套(如果存在)
我有此搜索查询,用于在根标题和描述中找到查询搜索词“ red dog”,并且还匹配嵌套的注释文档。GET /_all/video/_search{ "query":{ "bool":{ "should":[ { "multi_match":{ "query":"red dog", "fields":[ "Title", ...
2024-01-10指定在ElasticSearch中建立索引的字段
我有一个文档,其中包含许多我从未查询过的字段,因此我想关闭这些字段的索引以节省资源。我相信我需要禁用该_all字段,但是如何指定要对哪些字段建立索引呢?回答:默认情况下,所有字段也都在_all特殊字段内建立索引,该字段开箱即用地提供了所谓的catchall功能。但是,可以通过以下include_in...
2024-01-10带有嵌套聚合的Elasticsearch查询导致内存不足
我安装了16gb内存的Elasticsearch。我开始使用聚合,但是在尝试发出以下查询时遇到“java.lang.OutOfMemoryError:Java堆空间”错误:POST /test-index-syslog3/type-syslog/_search{ "query": { "query_string": { "default_field": "DstCountry", "query": "CN" } }, "a...
2024-01-10