ElasticSearch

Search by multiple values using NEST(ElasticSearch)

故事扮演 提交于 2021-01-29 07:07:52
问题 I have an index called " campaigns " with these records: "hits" : [ { "_index" : "campaigns", "_id" : "cf08b05c-c8b5-45cb-bca8-17267c3613fb", "_source" : { "PublisherId" : 1, "CurrentStatus" : "Pending" } }, { "_index" : "campaigns", "_id" : "39436cb3-483e-4fb4-92e4-4e06ecad27a1", "_source" : { "PublisherId" : 1, "CurrentStatus" : "Approved" } }, { "_index" : "campaigns", "_id" : "21436cb1-583e-4fb4-92e4-4e06ecad23a2", "_source" : { "PublisherId" : 1, "CurrentStatus" : "Rejected" } } ] I want

Create Input Format of Elasticsearch using Flink Rich InputFormat

感情迁移 提交于 2021-01-29 07:06:09
问题 We are using Elasticsearch 6.8.4 and Flink 1.0.18. We have an index with 1 shard and 1 replica in elasticsearch and I want to create the custom input format to read and write data in elasticsearch using apache Flink dataset API with more than 1 input splits in order to achieve better performance. so is there any way I can achieve this requirement? Note: Per document size is larger(almost 8mb) and I can read only 10 documents at a time because of size constraint and per reading request, we

Cannot add node to cluster (elasticsearch)

淺唱寂寞╮ 提交于 2021-01-29 06:57:47
问题 I'm trying to make the health of my cluster green. According to the following elasticsearch documentation: When you add more nodes to a cluster, it automatically allocates replica shards. When all primary and replica shards are active, the cluster state changes to green. source: https://www.elastic.co/guide/en/elasticsearch/reference/current/add-elasticsearch-nodes.html So I created 2 elasticsearch instances with the following configuration files: # Config File 1 cluster.name : PL node.name :

How to pass a variable that contains a file to a curl POST payload?

主宰稳场 提交于 2021-01-29 06:05:07
问题 I am trying to make a CURL command to hit an elasticsearch endpoint and what I have to do is essentially read a script from a file (a multi-lined file) and then pass that script into the json payload for a POST request. I don't know ho to pass it in correctly to the payload. I have tried ${script}, "'"${script}"'". Not sure how to proceed next My script: int editScore(def x) { x + 1; } ctx.new_post_score = editScore(ctx.post_score); ctx.new_grade = ctx.new_post_score; My bash script: location

Cant Run Elasticsearch on cpanel (Linux)

冷暖自知 提交于 2021-01-29 05:43:34
问题 I am having trouble in installing the Elasticsearch on my live webserver. I have terminal access. I downloaded the elasticsearch on my root directory (public_html) and extracted it as per elastic documnents. When on terminal i try to run elasticsearch i get the following error Kindly let me know what can i do and what is the right way to install and run elastic search on the live web server. Thank You 回答1: This is not because of disk storage, it's because of less RAM available in your system

Elasticsearch - query to get latest version of records from a flattened structure

青春壹個敷衍的年華 提交于 2021-01-29 05:21:10
问题 I have a scenario where I'd like to return the latest de-normalized data from an index in Elasticsearch grouped by a certain key value - in the scenario below => TradeRef. The below paints a better picture of data persisted in the index: {"Row": "1", "TradeRef": "A", "TradeRefDate": "2019-01-01 13:00", "TradeRefId": "FFF", "MessageId": "XXX", "MessageStatus": "S-Open"}, {"Row": "2", "TradeRef": "B", "TradeRefDate": "2019-01-01 13:00", "TradeRefId": "GGG", "MessageId": "YYY", "MessageStatus":

高性能 Nginx HTTPS 调优!为 HTTPS 提速 30%

半腔热情 提交于 2021-01-29 04:20:57
为什么要优化 Ngin HTTPS 延迟 Nginx 常作为最常见的服务器,常被用作负载均衡 (Load Balancer)、反向代理 (Reverse Proxy),以及网关 (Gateway) 等等。一个配置得当的 Nginx 服务器单机应该可以期望承受住 50K 到 80K 左右每秒的请求,同时将 CPU 负载在可控范围内。 但在很多时候,负载并不是需要首要优化的重点。比如对于卡拉搜索来说,我们希望用户在每次击键的时候,可以体验即时搜索的感觉,也就是说,每个搜索请求必须在 100ms - 200ms 的时间内端对端地返回给用户,才能让用户搜索时没有“卡顿”和“加载”。因此,对于我们来说,优化请求延迟才是最重要的优化方向。 这篇文章中,我们先介绍 Nginx 中的 TLS 设置有哪些与请求延迟可能相关,如何调整才能最大化加速。然后我们用优化卡拉搜索Nginx 服务器的实例来分享如何调整 Nginx TLS/SSL 设置,为首次搜索的用户提速 30% 左右。我们会详细讨论每一步我们做了一些什么优化,优化的动机和效果。希望可以对其它遇到类似问题的同学提供帮助。 TLS 握手和延迟 很多时候开发者会认为:如果不是绝对在意性能,那么了解底层和更细节的优化没有必要。这句话在很多时候是恰当的,因为很多时候复杂的底层逻辑必须包起来,才能让更高层的应用开发复杂度可控。比如说

Update all documents of Elastic Search using existing column value

主宰稳场 提交于 2021-01-29 03:10:30
问题 I have a field "published_date" in elastic search and there I have full date like yyyy-MM-dd'T'HH:mm:ss . I want to create 3 more columns for year , month and date where I have to use the existing published_date to update new 3 columns. Is there any inbuilt api to do this kind of work in e.s.? I am using elasticsearch 5. 回答1: You can use the update-by-query API in order to do this. It would simply boil down to running something like this: POST your_index/_update_by_query { "script": { "inline

Removing objects from nested fields in ElasticSearch

[亡魂溺海] 提交于 2021-01-29 02:10:20
问题 Is there a way in ElasticSearch wherein I can remove some the objects in the nested field array. So I have a nested field and it returns array of objects. I need to remove some objects in the nested field. Is it possible to do so in the query or I need to do that in my code 回答1: These extra nested documents are hidden; we can’t access them directly. To update, add, or remove a nested object, we have to reindex the whole document. It’s important to note that, the result returned by a search

elasticsearch calculate average of unique values

。_饼干妹妹 提交于 2021-01-29 01:31:35
问题 How can I dynamically calculate the average of unique values in elasticsearch? { "price" : 10000, "color" : "red" } { "price" : 20000, "color" : "red" } { "price" : 30000, "color" : "green" } { "price" : 15000, "color" : "blue" } { "price" : 12000, "color" : "green" } { "price" : 20000, "color" : "red" } { "price" : 80000, "color" : "red" } { "price" : 25000, "color" : "blue" } In the above data, how can I get the unique values of the "color" field and then the averages for each of the unique