Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Flux(v6.9.0) to filter through fuzzy(Imprecise) queries(regular expression)? #604

Closed
isMrZhang opened this issue Jul 14, 2023 · 1 comment · Fixed by #717
Closed
Milestone

Comments

@isMrZhang
Copy link

isMrZhang commented Jul 14, 2023

Proposal:
Filter fuzzy(Imprecise) queries by tag or field.

Current behavior:
Finding that there is no imprecise filtering query method or regular expression filtering method, I tried using custom but he doesn't work as expected.

Flux flux = Flux
            .from("basic")
            .range(Instant.now(), Instant.now())
            .filter(Restrictions.and(
                    Restrictions.measurement().equal("api_log"),
                    Restrictions.tag("org_id").equal("EDUCLOUD"),
                    Restrictions.tag("title").custom("/account/", "=~"))
            .pivot(List.of("_time"), List.of("_field"), "_value")
            .group()
            .sort(List.of("_time"), true)
            .limit(10, (0 - 1) * 10);

anticipate:

from(bucket:"basic")
	|> range(start:2023-07-14T15:59:59.000000000Z, stop:2023-07-14T15:59:59.000000000Z)
	|> filter(fn: (r) => (r["_measurement"] == "api_log" and r["orgId"] == "EDUCLOUD" and r["title"] =~ /account/))
	|> pivot(rowKey:["_time"], columnKey:["_field"], valueColumn:"_value")
	|> group()
	|> sort(columns:["_time"], desc:true)
	|> limit(n:10, offset:0)

actual:

from(bucket:"basic")
	|> range(start:2023-07-14T15:59:59.000000000Z, stop:2023-07-14T15:59:59.000000000Z)
	|> filter(fn: (r) => (r["_measurement"] == "api_log" and r["orgId"] == "EDUCLOUD" and r["title"] =~ "/account/"))
	|> pivot(rowKey:["_time"], columnKey:["_field"], valueColumn:"_value")
	|> group()
	|> sort(columns:["_time"], desc:true)
	|> limit(n:10, offset:0)

error:
com.influxdb.exceptions.InternalServerErrorException: HTTP status code: 500; Message: type error 3:88-3:109: string != regexp
image

Desired behavior:
Imprecise filter query method or regular expression filter method, custom filter regular expression is normal

Alternatives considered:
Restrictions.custom() In the tank regular expression

Use case:
Regular expressions (regular expressions) are very powerful when matching patterns in large data collections, and they can effectively filter the amount of data.

@isMrZhang isMrZhang changed the title How to use Flux to filter through fuzzy(Imprecise) queries(regular expression)? How to use Flux(v6.9.0) to filter through fuzzy(Imprecise) queries(regular expression)? Jul 14, 2023
@KYankee6
Copy link
Contributor

KYankee6 commented May 7, 2024

same problem here. is there any update?

@KYankee6 KYankee6 mentioned this issue May 7, 2024
6 tasks
@bednar bednar added this to the 7.1.0 milestone May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants