The issue escape letters in query string elastic search
I have a query
POST xxxxxx_*/_search
{
"query": {
"query_string": {
"query": "timestamp:[2020-01-07T10:33:16.726591 TO *] AND type:(*virtualMachines OR type:\"Instance\" OR \"compute#instance\")"
}
},
"sort": [
{
"timestamp": {
"order": "desc"
}
}
]
}
I wonder why there is no type:sql#instance in the query sentence but the result contains sql#instance and compute#instance state.
I tried to separate it like this:
type:(*virtualMachines OR type:"Instance" OR "compute#instance")
But still the same result. Any idea for this issue!! Thanks!
See also questions close to this topic
-
Logstash throws [message=>"undefined method `update' for nil:NilClass"] when Elasticsearch index template defined in logstash
I am trying to load data from sql server to elastic search using logstash. For index creation i am using index template that is specified in the config file of logstash.
Output field of logstash.config :
output{ stdout { codec => json_lines } elasticsearch { hosts => ["localhost:9200"] document_id => "%{[id]}" manage_template => true template => "C:/Users/Lich/Documents/logstash-7.10.1-windows-x86_64/logstash-7.10.1/logstash_test.json" template_name => "logstash_test" template_overwrite => true } }
Error while running logstash :
[2021-01-25T19:48:28,232][INFO ][logstash.outputs.elasticsearch][main] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["//localhost:9200"]} [2021-01-25T19:48:28,298][INFO ][logstash.outputs.elasticsearch][main] Using mapping template from {:path=>"C:/Users/Lich/Documents/logstash-7.10.1-windows-x86_64/logstash-7.10.1/logstash_test.json"} [2021-01-25T19:48:28,370][INFO ][logstash.javapipeline ][main] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>1000, "pipeline.sources"=>["C:/Users/Lich/Documents/logstash-7.10.1-windows-x86_64/logstash-7.10.1/sampleconf.conf"], :thread=>"#<Thread:0x797ce1a8 run>"} [2021-01-25T19:48:28,509][ERROR][logstash.outputs.elasticsearch][main] Failed to install template. {:message=>"undefined method `update' for nil:NilClass", :class=>"NoMethodError", :backtrace=>["C:/Users/Lich/Documents/logstash-7.10.1-windows-x86_64/logstash-7.10.1/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.0-java/lib/logstash/outputs/elasticsearch/template_manager.rb:42:in `add_ilm_settings_to_template'", "C:/Users/Lich/Documents/logstash-7.10.1-windows-x86_64/logstash-7.10.1/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.0-java/lib/logstash/outputs/elasticsearch/template_manager.rb:15:in `install_template'", "C:/Users/Lich/Documents/logstash-7.10.1-windows-x86_64/logstash-7.10.1/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.0-java/lib/logstash/outputs/elasticsearch/common.rb:218:in `install_template'", "C:/Users/Lich/Documents/logstash-7.10.1-windows-x86_64/logstash-7.10.1/vendor/bundle/jruby/2.5.0/gems/logstash-output-elasticsearch-10.7.0-java/lib/logstash/outputs/elasticsearch/common.rb:49:in `block in setup_after_successful_connection'"]} [2021-01-25T19:48:28,546][INFO ][logstash.outputs.elasticsearch][main] Creating rollover alias <logstash-{now/d}-000001> [2021-01-25T19:48:29,463][INFO ][logstash.javapipeline ][main] Pipeline Java execution initialization time {"seconds"=>1.08} [2021-01-25T19:48:29,802][INFO ][logstash.javapipeline ][main] Pipeline started {"pipeline.id"=>"main"} [2021-01-25T19:48:29,888][INFO ][logstash.agent ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
Index template configuration:
{ "index_patterns":"*-logstash_test-*", "priority":1, "template":{ "settings":{ "analysis":{ "analyzer":{ "test_autocomplete":{ "tokenizer":"test_tokenizer" } }, "tokenizer":{ "test_tokenizer":{ "custom_token_chars":"'-", "max_gram":"3", "min_gram":"3", "token_chars":[ ], "type":"ngram" } } }, "mappings":{ "properties":{ "test_id":{ "type":"text", "analyzer":"test_autocomplete" } } } } } }
Although it fails the index gets created with the data, but the analyzers specified in the
settings{..}
does not reflect. I am new to ELK stack and not sure on why this is happening.Elasticsearch Version : 7.10.1
Logstash Version : 7.10.1
-
Kubernetes event logs to elasticsearch
I'm trying to forward kubernetes-event logs to elasticsearch using fluentd.I currently use
fluent/fluentd-kubernetes-daemonset:v1.10.1-debian-elasticsearch7-1.0
as container image to forward my application logs to elasticsearch cluster.I've searched enough & my problem is that this image doesn't have enough documentation as to accomplishing this task(i.e; forward kubernetes event related logs).I've found this plugin from splunk which has desired output but this has overhead like :
add above plugin's gem to bundler.
install essential tools like
make
etc.install the plugin .
Sure I can do above steps using
init-container
, but above operations are adding ~200MB to disk space .I'd like to know if it can be accomplished with smaller footprint or other way.Any help is appreciated.
Thanks.
-
Scaling down ElasticSearch: what happens with closed indices?
To scale down ElasticSearch, I usually disable allocation on a node, wait for shards to relocate, and then remove the node, e.g.:
curl -X PUT "localhost:9200/_cluster/settings" -d'{ "transient" : { "cluster.routing.allocation.exclude._name" : "node-4" } }'
As I understand, open indices' shards will be relocated to other nodes... but what happens to closed indices?
A closed index is, per my understanding, ignored on snapshots... so it makes me think if it will be ignored when setting an allocation exclusion as well.
After excluding allocation to a node, I went to check its disk usage... and it seems like it still has a lot of things there:
$ du -hs /usr/share/elasticsearch/nodes/0/ 131G /usr/share/elasticsearch/nodes/0/
So, my questions are:
- What happens to closed indices when I exclude a node from allocation?
- How safe it is to do this if I don't want to loose those closed indices (for whatever reason)?
-
Cant access Nextcloud from outside my network - Netgear Router
So I have been trying to setup Nextcloud on my Raspberry Pi for a few days now. So far the cloud works, I can access it form inside my network without problems. To make it also accessible from outside my network I activated port forwarding on my Netgear router like you can see in the picture below:
I checked my settings multiple times, but everything seemed fine, so I tried to setup my Raspberry Pi in a different network with a FritzBox router. I also enabled port forwarding there and everything worked perfectly and I was able to access the cloud outside the network.
So my question is, if I did anything wrong with configuring the Netgear router or if there is another setting or something that needs to be activated. The only other possible explanation for me would be, that there is a bug in the firmware of Netgear. I would really appreciate any help, cause I am really dispairing. And if you need any additional information from me don't hesitate to ask.
-
how to create google cloud function with kubernetes client
Is it possible to create a google cloud function in .NET to run job in kubernetes? What are the options for doing this?
Thanks in advance for your help.
-
Cloud computing using blockchain
my project name: cloud computing service via blockchain technologies Here, it is my doubt that I need to organize and deploy cloud services like IaaS, PaaS, SaaS services in the ethereum network and customers should be able to access those services in the ethereum network and should make payments by using smart contracts? for organization and deployment, we can use docker or OpenStack/pro max.
So, How I can organize and deploy those services in the ethereum network?
can anyone help me, please?
Thanks in advance
-
Value assigned to state via useState is not being reflected by console.log
I'll try to explain the issue I'm encountering as simply as possible. Within a
useEffect
hook, I retrieve a query-string parameter's value and attempt to assign it to state using theuseState
hook.// The web browser localhost:3000?someValue=true
// someHook.js import querystring from 'query-string' import { useEffect, useState } from 'react' const useSomeHook = () => { const [ someState, setSomeState] = (false) useEffect(() => { const { someValue } = querystring.parse(window.location.search, { parseBooleans: true }) setSomeState(someValue) console.log(someValue, someState) // true, false }) }
someValue
andsomeState
have different values;someState
's value hasn't yet changed when logged. Does anyone know how to overcome this situation? It's causing a race condition when I apply this pattern in my code. -
rewrite query string with .htaccess without altering link structure
I would like to remove the query string from the URL and rewrite it without the query string without having to re-code the link structure.
I have added this:
RewriteCond %{QUERY_STRING} . RewriteRule ^$ /? [R,L]
to the end of my existing .htaccss code (so that it is the last thing that is done, since there are other re-write rules before this) but the query string is not removed. What am I doing wrong?
This is the content of my current .htaccess file:
RewriteEngine On RewriteRule ^userfiles/ - [L] RewriteRule ^userdata/ - [L] RewriteCond %{THE_REQUEST} /index\.php\?p=(?!admin)(?!superadmin)((?![^&]*?edit)[^\s&]+) [NC] RewriteCond %{THE_REQUEST} /index\.php\?p=([^\s&]+) [NC] RewriteRule ^ /%1? [R=301,L,QSA] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/?$ index.php?p=$1 [L,QSA]
Also I have a general question about how that affects the availability of query strings as variables... in other words if I re-write the URL to NOT show the query strings, is that query string still available if in PHP I write $_GET['q'] or will it then be not set anymore? Thanks
-
Regex expression to match a URL that has no query String
Wordpress Context BTW. To put into htaccess.
I need it to match the Website URL only if there are no parameters.RewriteCond %{REQUEST_URI} ^/?$
I tried reading on it and playing with this line, but nothing worked.
TIA for any tips.EDIT: I need the regex to match the the website URL when there is no path and no parameters. I want to redirect users only when they access the main page. But using this is making internal linking of wordpress fail, so I'm using
RewriteCond %{REQUEST_URI} ^/home/?$
and redirecting them when they access home only. I'm trying to read documentation but is going above my head.TIA for nay tips.