ElasticSearch

In “spring-data-elasticsearch” 4.0.4.RELEASE, how to convert SearchHits to Page?

前提是你 提交于 2021-01-28 08:45:58
问题 In spring-data-elasticsearch 4.0.4.RELEASE, ElasticsearchRestTemplate 's queryForPage() methods are deprecated, need to use search() instead, which return SearchHits instead of Page . So, how to convert SearchHits to Page , or how to still get results as Page ? I have searched via google, and checked official doc, and checked source code, still don't know the best way, any help? 回答1: The Query parameter to be passed into the search() method can have a Pageable set for the request. To wrap the

How to add “updatedAt” timestamp to elasticsearch documents

情到浓时终转凉″ 提交于 2021-01-28 08:29:49
问题 I want to ensure that all documents of a certain doc_type have a "updatedAt" timestamp (ISO 8601) that gets updated whenever the document is updated. It needs to be a server-side timestamp as I don't know if I can trust that all of the clients times are in sync. I use an ingest pipeline to add "createdAt" timestamps, but it seems that pipelines are not supported using the update API. I've tried using update scripts (using the newly available 'ctx._now' value), but cannot get the parsing into

“Filter then Aggregation” or just “Filter Aggregation”?

拥有回忆 提交于 2021-01-28 08:27:26
问题 I am working on ES recently and I found that I could achieve the almost same result but I have no clear idea as to the DIFFERENCE between these two. "Filter then Aggregation" POST kibana_sample_data_flights/_search { "size": 0, "query": { "constant_score": { "filter": { "term": { "DestCountry": "CA" } } } }, "aggs": { "ca_weathers": { "terms": { "field": "DestWeather" } } } } "Filter Aggregation" POST kibana_sample_data_flights/_search { "size": 0, "aggs": { "ca": { "filter": { "term": {

Error when increase the max_result_window in elasticsearch using a python

橙三吉。 提交于 2021-01-28 07:57:40
问题 I need to increase the max_result_window in elasticsearch using a python. Here is my code: elastic_client = Elasticsearch([{'host': 'localhost', 'port': 9200}], timeout=800) elastic_client.indices.put_settings(index="studentvle",body= {"index" : {"max_result_window" : 8609436}}) total_docsstudentvle = 8609436 responsestudentvle = elastic_client.search( index='studentvle', body={}, size=total_docsstudentvle ) However, suddenly my elasticsearch stopped, and I got an error as below when I run

hapi fhir elastic search how to configure

ⅰ亾dé卋堺 提交于 2021-01-28 07:39:08
问题 I am using hapi fhir v5.1.0 with jpa server( hapi-fhir-jpa-server-starter ). As per the description, this version contains elastic search library for text search. How can I configure elastic server here? I see some entries in the properties file and configured the elastic rest url, but nothing works and always get the following error - HSEARCH000222 - the search factory was not initialized . Could someone please let me know the configuration steps required to activate elastic search inside

How to query fields with path_hierarchy analyzer in elasticsearch?

耗尽温柔 提交于 2021-01-28 06:06:10
问题 I have configured path_analyzer in elasticsearch using below configuration. PUT /elastic_course { "settings": { "analysis": { "analyzer": { "path_analyzer": { "tokenizer": "path_tokenizer" }, "reverse_path_analyzer": { "tokenizer": "path_tokenizer" } }, "tokenizer": { "path_tokenizer": { "type": "path_hierarchy", "delimiter": "/", "replacement": "-" }, "reverse_path_tokenizer": { "type": "path_hierarchy", "delimiter": "/", "replacement": "-" } } } }, "mappings": { "book" : { "properties": {

Spark task runs on only one executor

本小妞迷上赌 提交于 2021-01-28 06:01:32
问题 Hello everyone first and foremost i'm aware of the existence of this thread, Task is running on only one executor in spark. However this is not my case as i'm using repartition(n) on my dataframe. Basically i'm loading a DataFrame by fetching data from an ElasticSearch index through Spark as follows: spark = SparkSession.builder \ .appName("elastic") \ .master("yarn")\ .config('spark.submit.deployMode','client')\ .config("spark.jars",pathElkJar) \ .enableHiveSupport() \ .getOrCreate() es

Elastic search aggregation using min_doc_count=0 returns all the buckets which are not related to query results or hits

淺唱寂寞╮ 提交于 2021-01-28 05:55:30
问题 Here is my query - { "from": 0, "size": 100, "query": { "bool": { "filter": [ { "terms": { "folderId.keyword": [ "ff98505e-cdff-43aa-8b05-197bc3f3265e" ], "boost": 1 } }, { "terms": { "objectType.keyword": [ "File" ], "boost": 1 } }, { "term": { "tenantId": { "value": "34202", "boost": 1 } } } ], "adjust_pure_negative": true, "boost": 1 } }, "aggs":{ "_byformat":{ "terms":{ "field":"format.keyword", "min_doc_count":0, "size":200 } } } } result with min_doc_count = 0 - "took" : 1, "timed_out"

ELK接口调用

不问归期 提交于 2021-01-28 05:44:08
一、查询 1、查看ES集群健康值 curl http://<ES_IP>:9200/_cluster/health?pretty 2、查看每个索引的状态 curl -XGET "http://<ES_IP>:9200/_cat/indices?v" 3、查看某个索引的status curl -s http://<ES_IP>:9200/_cat/indices/IndexName?h=status 4、查看状态red的索引 curl -XGET http://<ES_IP>:9200/_cat/indices |awk '$1 ~/red/' 5、查询索引库的settings信息 curl -XGET http://<ES_IP>:9200/<index_name>/settings?pretty?pretty=true 6、查询索引别名 查询所有别名信息: curl -XGET http://<ES_IP>:9200/_cat/aliases?v 查询某个索引下的别名信息: curl -XGET http://<ES_IP>:9200/<index_name>/_alias/* 二、修改 1、关闭不需要的索引,减少内存占用 curl -XPOST "http://<ES_IP>:9200/<index_name>/_close" 2、操作索引 操作不存在索引: curl

why does elasticsearch calculates score for term queries?

前提是你 提交于 2021-01-28 05:21:37
问题 I want to make a simple query based on knowing a unique field value using a term query. For instance: { "query": { "term": { "products.product_id": { "value": "Ubsdf-234kjasdf" } } } } Regarding term queries , Elasticsearch documentation states: Returns documents that contain an exact term in a provided field. You can use the term query to find documents based on a precise value such as a price, a product ID, or a username. On the other hand, documentation also suggests that the _score is