Page MenuHomePhabricator

Ensure dateCreated property exists at index creation time
ClosedPublic

Authored by WikiChad on Dec 30 2014, 5:42 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 8:38 AM
Unknown Object (File)
Sat, Dec 7, 10:46 PM
Unknown Object (File)
Thu, Dec 5, 8:41 PM
Unknown Object (File)
Wed, Nov 27, 4:23 PM
Unknown Object (File)
Nov 19 2024, 2:10 PM
Unknown Object (File)
Nov 14 2024, 9:56 AM
Unknown Object (File)
Oct 27 2024, 7:26 AM
Unknown Object (File)
Oct 19 2024, 11:55 PM
Subscribers

Details

Summary

Since the default query will sort on this when no query string is
attached we want to make sure the property at least exists.

Otherwise Elasticsearch yells at you: "No mapping found for [dateCreated]
in order to sort on" when you try to search for documents that haven't
been indexed yet.

Test Plan

Searched for Mocks and Initiatives (no such documents exist in my index)
and got the error. After patching and reinitializing the index, the error
during querying went away.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

WikiChad retitled this revision from to Ensure dateCreated property exists at index creation time.
WikiChad updated this object.
WikiChad edited the test plan for this revision. (Show Details)
epriestley added a reviewer: epriestley.

Is "string" the best type for this field? We store an epoch timestamp in it, so I'd naively expect "int" or maybe "epoch". Shoot me a followup if that makes any sense.

This revision is now accepted and ready to land.Dec 30 2014, 10:46 AM
This revision was automatically updated to reflect the committed changes.

We could probably do better than string, but that's what the index was doing during automatic mapping creation anyway so I figured the status quo was ok for now.