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

HitsMonth calculation fails with parse_exception #1363

Closed
shreddedbacon opened this issue Nov 1, 2019 · 0 comments · Fixed by #1380 · May be fixed by #1381
Closed

HitsMonth calculation fails with parse_exception #1363

shreddedbacon opened this issue Nov 1, 2019 · 0 comments · Fixed by #1380 · May be fixed by #1381

Comments

@shreddedbacon
Copy link
Member

@shreddedbacon shreddedbacon commented Nov 1, 2019

Describe the bug
When running the following query, the result returns with errors

query {
  allProjects { 
      _:environments(includeDeleted: true, type: PRODUCTION) { 
      project { 
        name 
      } 
      openshiftProjectName
      name
      __:hitsMonth(month: "2019-10") { 
        total 
      } 
    }
  } 
}

The errors are

[parse_exception] failed to parse date field [2019-10] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [2019-10] with format [strict_date_optional_time||epoch_millis]] (and) [parse_exception] failed to parse date field [2019-10] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [2019-10] with format [strict_date_optional_time||epoch_millis]] (and) [parse_exception] failed to parse date field [2019-10] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [2019-10] with format [strict_date_optional_time||epoch_millis]] (and) [parse_exception] failed to parse date field [2019-10] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [2019-10] with format [strict_date_optional_time||epoch_millis]]

The call to elasticsearch is failing https://github.com/amazeeio/lagoon/blob/master/services/api/src/resources/environment/resolvers.js#L356-L385

A successful request needs to contain a full timestamp YYYY-MM-DDTHH:MM:SS rather than just the YYYY-MM

The following query succeeds.

GET router-logs-project-*/_count
{
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "@timestamp": {
              "gte": "2019-10-01T00:00:00",
              "lte": "2019-11-01T00:00:00"
            }
          }
        }
      ],
      "must_not": [
        {
          "match_phrase": {
            "request_header_useragent": {
              "query": "StatusCake"
            }
          }
        }
      ]
    }
  }
}
wintercreative added a commit that referenced this issue Nov 4, 2019
@wintercreative wintercreative mentioned this issue Nov 4, 2019
2 of 3 tasks complete
Schnitzel added a commit that referenced this issue Nov 5, 2019
Schnitzel added a commit that referenced this issue Nov 6, 2019
#1363: tell elasticsearch which format we're sending data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.