Query using multiples operator OR - grafana

I need to write a query that use any of the different tag I define, because the historian database supports only this type of where condition.
{tag="pressure" OR tag="level" OR tag="prometheus"} Is it possible to write logical binary operators?
I donĀ“t know how to resolve this.

Related

What is the equivalent to Postgres's ## to_tsquery(:searchQuery) in ElasticSearch?

We've migrated from a postgres database that was using vectors and using ## to_tsquery(:searchQuery) to perform queries. We are now using ElasticSearch and having a hard time getting the same accuracy that we saw with Postgres Vector searching.
For example we have the phrase "deadpool vs carnage" as the value for a title field on a document and would like this document to come back when performing a search with a query value of "dead carn".
When using postgres this wasn't a problem. But with ElasticSearch I'm unable to get this to return correctly.
I've tried different variations of all the match queries and can't get this to work. Any help would be very much appreciated
Elasticsearch is such a robust system that often times, like with many things, it's easy to overlook the simplest solution.
I ended up using the query_string search with wildcards in the string to achieve this.
You can pass in a query value of dead* carn*.
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

Mongoose LIKE operator for numbers

Mongoose allows a similar functionality using Regex for strings
But I did not find a single resource for how to use something similar for numbers
Say I have a number in my colection "88682265456" and when a user searches for "226" he get's that number and similar numbers, the way LIKE operator behaves in SQL databases.
I tried converting the field to a string using $where operator, but my atlas database tier does not support it.
What am I missing here?

Saving common aggregations in MongoDB

Say I have a Mongo aggregation I know that I will use frequently, for example, finding the average of a dataset.
Essentially, I want someone to make an API for the database such that someone could type db.collection.average() in the mongo shell and get the result of that function, so that someone without much knowledge of the aggregation framework would easily be able to get the average (or result of any complicated aggregation function I create). What is the best way to achieve this?
As of MongoDB 3.4, you can create views that wrap a defined aggregation pipeline. Sounds like a perfect fit for your use case.

How do I write an "or" logical operator on Prometheus or Grafana

I need to write a query that use any of the different jobs I define.
{job="traefik" OR job="cadvisor" OR job="prometheus"}
Is it possible to write logical binary operators?
Prometheus has an or logical binary operator, but what you're asking about here is vector selectors.
You can use a regex for this {job=~"traefik|cadvisor|prometheus"}, however that you want to do this is a smell.

MongoDB query comparing 2 fields in same collection without $where

Does MongoDB supports comparing two fields in same collection by using native operators (not $where and JavaScript)?
I already looked at similar questions and all answers used $where / JavaScript.
MongoDB documentation clearly states that:
JavaScript executes more slowly than the native operators listed on this page, but is very flexible.
My primary concern is speed and I would like to use indexes if possible. So is comparing two fields in MongoDB possible without using JavaScript?
This is not currently possible, but it will be possible through the new aggregation framework currently under development (2.1+). This aggregation framework is native and does not rely on relatively slow JavaScript execution paths.
For more details check http://www.mongodb.org/display/DOCS/Aggregation+Framework
and the progress at https://jira.mongodb.org/browse/SERVER-447
From reading the documentation you link it doesn't look like MongoDB has the ability to compare two document properties using only native operators.
Perhaps you can modify the documents themselves (and/or the code which saves the documents) to include a boolean property with value resulting from the comparison (ahead-of-time) and then simply query on that new property as needed. You could even index it for even better performance.