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

MetricPredicate translates to incompatible query in Elasticsearch REST Client #2852

Closed
lorthirk opened this issue Feb 10, 2020 · 0 comments · Fixed by #2853
Closed

MetricPredicate translates to incompatible query in Elasticsearch REST Client #2852

lorthirk opened this issue Feb 10, 2020 · 0 comments · Fixed by #2853
Assignees
Labels
Bug This is a bug or an unexpected behaviour. Fix it! REST API We hope to REST everyday

Comments

@lorthirk
Copy link

Describe the bug
The current implementation of MetricPredicate translate to a query that consider the Datastore Schema. Specifically, an example MetricPredicate would translate to JSON as

{
    "query": {
        "range" : {
            "temperature" : {
                "gte" : 10,
                "lte" : 20,
            }
        }
    }
}

While it should translate to this JSON to support our current schema:

{
    "query": {
        "range" : {
            "metrics.temperature.int" : {
                "gte" : 10,
                "lte" : 20,
            }
        }
    }
}

This means that filtering for a metric type and/or value would always return 0 entries

To Reproduce
Steps to reproduce the behavior:

  1. Perform a REST call to /{scopeId}/dataMessages filtering on metricName, metricType, metricMin and metricMax

Expected behavior
A set of results matching the name, type and values would return

Version of Kapua
1.0.9
1.1.2

Type of deployment
[x] Local Vagrant deployment
[x] Docker
[x] Openshift (in its variants)
[x] Others

Main component affected
[ ] Console (in case of console please report info on which browser you encountered the problem)
[x] REST API
[ ] Message Broker
[x] - Others

Additional context
Basically any component that uses di ES REST client is affected

@lorthirk lorthirk added the REST API We hope to REST everyday label Feb 10, 2020
@lorthirk lorthirk self-assigned this Feb 10, 2020
@Coduz Coduz added the Bug This is a bug or an unexpected behaviour. Fix it! label Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This is a bug or an unexpected behaviour. Fix it! REST API We hope to REST everyday
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants