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

1/1/1970 blanked #2362

Closed
jimmyjones2 opened this issue Dec 17, 2014 · 2 comments
Closed

1/1/1970 blanked #2362

jimmyjones2 opened this issue Dec 17, 2014 · 2 comments
Assignees
Labels
bug Fixes for quality problems that affect the customer experience PR sent
Milestone

Comments

@jimmyjones2
Copy link
Contributor

eg:

curl -XPUT "localhost:9200/logs-2014.12.17/test/1" -d '
{ "@timestamp": "2014-12-17T13:36:30", "mydate": "1970-01-01T00:00:00Z", "test": "test2" }'

kbn-1970
Think script_fields are to blame, maybe should use containsKey instead?

  "script_fields": {
    "@timestamp": {
      "script": "if (doc[\"@timestamp\"].value == 0) { null } else { doc[\"@timestamp\"].value }"
    },
    "mydate": {
      "script": "if (doc[\"mydate\"].value == 0) { null } else { doc[\"mydate\"].value }"
    }
  }
@rashidkpc
Copy link
Contributor

In our testing doc.containsKey('@timestamp') doesn't actually work here as the elasticsearch date field defaults to 0, sort of. After bouncing the problem around with a few other engineers we came up with a solution that does:

doc['@timestamp'].value will return 0 on missing fields due to null_value casting, however we can abuse the fact that all fields are multi-valued and check the length of the array instead doc['@timestamp'].values.size() will return 0 for missing fields. Fix incoming.

@rashidkpc
Copy link
Contributor

Scratch that, for our purposes here fielddata_fields: [] will work better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience PR sent
Projects
None yet
Development

No branches or pull requests

2 participants