We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Sorting searches by 'Date last updated' results in 503
**Describe the bug**

When trying to search for anything on pypi.org, sorting by relevance or trending works fine, but sorting by date last updated returns a 503 error.

**Expected behavior**

Search results, sorted by date.

**To Reproduce**

Example URL: https://pypi.org/search/?q=test&o=-created

Result:

> Sorry, something went wrong
> 
> PyPI is down for maintenance or is having an outage.
> 
> This is affecting several of our services, including our web interface.
> If you are trying to install a package, you should be able to pip install packages without problem.
> 
>     Check our status page, or
>     View Python Status on Twitter

The status page, though, shows all green.


**My Platform**

- Win 10, Firefox 66.0.3
- Ubuntu 18.04, Chrome 74.0.3729.108

---

Edit: I know this functionality was working at least as recently as last Thursday, 2 May 2019.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `warehouse/packaging/search.py`
Content:
```
1 # Licensed under the Apache License, Version 2.0 (the "License");
2 # you may not use this file except in compliance with the License.
3 # You may obtain a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 # See the License for the specific language governing permissions and
11 # limitations under the License.
12 
13 import packaging.version
14 
15 from elasticsearch_dsl import Date, Document, Float, Keyword, Text, analyzer
16 
17 from warehouse.search.utils import doc_type
18 
19 EmailAnalyzer = analyzer(
20     "email",
21     tokenizer="uax_url_email",
22     filter=["standard", "lowercase", "stop", "snowball"],
23 )
24 
25 NameAnalyzer = analyzer(
26     "normalized_name",
27     tokenizer="lowercase",
28     filter=["standard", "lowercase", "word_delimiter"],
29 )
30 
31 
32 @doc_type
33 class Project(Document):
34 
35     name = Text()
36     normalized_name = Text(analyzer=NameAnalyzer)
37     version = Keyword(multi=True)
38     latest_version = Keyword()
39     summary = Text(analyzer="snowball")
40     description = Text(analyzer="snowball")
41     author = Text()
42     author_email = Text(analyzer=EmailAnalyzer)
43     maintainer = Text()
44     maintainer_email = Text(analyzer=EmailAnalyzer)
45     license = Text()
46     home_page = Keyword()
47     download_url = Keyword()
48     keywords = Text(analyzer="snowball")
49     platform = Keyword()
50     created = Date()
51     classifiers = Keyword(multi=True)
52     zscore = Float()
53 
54     @classmethod
55     def from_db(cls, release):
56         obj = cls(meta={"id": release.normalized_name})
57         obj["name"] = release.name
58         obj["normalized_name"] = release.normalized_name
59         obj["version"] = sorted(
60             release.all_versions, key=lambda r: packaging.version.parse(r), reverse=True
61         )
62         obj["latest_version"] = release.latest_version
63         obj["summary"] = release.summary
64         obj["description"] = release.description
65         obj["author"] = release.author
66         obj["author_email"] = release.author_email
67         obj["maintainer"] = release.maintainer
68         obj["maintainer_email"] = release.maintainer_email
69         obj["home_page"] = release.home_page
70         obj["download_url"] = release.download_url
71         obj["keywords"] = release.keywords
72         obj["platform"] = release.platform
73         obj["created"] = release.created
74         obj["classifiers"] = release.classifiers
75         obj["zscore"] = release.zscore
76 
77         return obj
78
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/warehouse/packaging/search.py b/warehouse/packaging/search.py
--- a/warehouse/packaging/search.py
+++ b/warehouse/packaging/search.py
@@ -75,3 +75,8 @@
         obj["zscore"] = release.zscore
 
         return obj
+
+    class Index:
+        # make sure this class can match any index so it will always be used to
+        # deserialize data coming from elasticsearch.
+        name = "*"

{"golden_diff": "diff --git a/warehouse/packaging/search.py b/warehouse/packaging/search.py\n--- a/warehouse/packaging/search.py\n+++ b/warehouse/packaging/search.py\n@@ -75,3 +75,8 @@\n         obj[\"zscore\"] = release.zscore\n \n         return obj\n+\n+    class Index:\n+        # make sure this class can match any index so it will always be used to\n+        # deserialize data coming from elasticsearch.\n+        name = \"*\"\n", "issue": "Sorting searches by 'Date last updated' results in 503\n**Describe the bug**\r\n\r\nWhen trying to search for anything on pypi.org, sorting by relevance or trending works fine, but sorting by date last updated returns a 503 error.\r\n\r\n**Expected behavior**\r\n\r\nSearch results, sorted by date.\r\n\r\n**To Reproduce**\r\n\r\nExample URL: https://pypi.org/search/?q=test&o=-created\r\n\r\nResult:\r\n\r\n> Sorry, something went wrong\r\n> \r\n> PyPI is down for maintenance or is having an outage.\r\n> \r\n> This is affecting several of our services, including our web interface.\r\n> If you are trying to install a package, you should be able to pip install packages without problem.\r\n> \r\n>     Check our status page, or\r\n>     View Python Status on Twitter\r\n\r\nThe status page, though, shows all green.\r\n\r\n\r\n**My Platform**\r\n\r\n- Win 10, Firefox 66.0.3\r\n- Ubuntu 18.04, Chrome 74.0.3729.108\r\n\r\n---\r\n\r\nEdit: I know this functionality was working at least as recently as last Thursday, 2 May 2019.\n", "before_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport packaging.version\n\nfrom elasticsearch_dsl import Date, Document, Float, Keyword, Text, analyzer\n\nfrom warehouse.search.utils import doc_type\n\nEmailAnalyzer = analyzer(\n    \"email\",\n    tokenizer=\"uax_url_email\",\n    filter=[\"standard\", \"lowercase\", \"stop\", \"snowball\"],\n)\n\nNameAnalyzer = analyzer(\n    \"normalized_name\",\n    tokenizer=\"lowercase\",\n    filter=[\"standard\", \"lowercase\", \"word_delimiter\"],\n)\n\n\n@doc_type\nclass Project(Document):\n\n    name = Text()\n    normalized_name = Text(analyzer=NameAnalyzer)\n    version = Keyword(multi=True)\n    latest_version = Keyword()\n    summary = Text(analyzer=\"snowball\")\n    description = Text(analyzer=\"snowball\")\n    author = Text()\n    author_email = Text(analyzer=EmailAnalyzer)\n    maintainer = Text()\n    maintainer_email = Text(analyzer=EmailAnalyzer)\n    license = Text()\n    home_page = Keyword()\n    download_url = Keyword()\n    keywords = Text(analyzer=\"snowball\")\n    platform = Keyword()\n    created = Date()\n    classifiers = Keyword(multi=True)\n    zscore = Float()\n\n    @classmethod\n    def from_db(cls, release):\n        obj = cls(meta={\"id\": release.normalized_name})\n        obj[\"name\"] = release.name\n        obj[\"normalized_name\"] = release.normalized_name\n        obj[\"version\"] = sorted(\n            release.all_versions, key=lambda r: packaging.version.parse(r), reverse=True\n        )\n        obj[\"latest_version\"] = release.latest_version\n        obj[\"summary\"] = release.summary\n        obj[\"description\"] = release.description\n        obj[\"author\"] = release.author\n        obj[\"author_email\"] = release.author_email\n        obj[\"maintainer\"] = release.maintainer\n        obj[\"maintainer_email\"] = release.maintainer_email\n        obj[\"home_page\"] = release.home_page\n        obj[\"download_url\"] = release.download_url\n        obj[\"keywords\"] = release.keywords\n        obj[\"platform\"] = release.platform\n        obj[\"created\"] = release.created\n        obj[\"classifiers\"] = release.classifiers\n        obj[\"zscore\"] = release.zscore\n\n        return obj\n", "path": "warehouse/packaging/search.py"}], "after_files": [{"content": "# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport packaging.version\n\nfrom elasticsearch_dsl import Date, Document, Float, Keyword, Text, analyzer\n\nfrom warehouse.search.utils import doc_type\n\nEmailAnalyzer = analyzer(\n    \"email\",\n    tokenizer=\"uax_url_email\",\n    filter=[\"standard\", \"lowercase\", \"stop\", \"snowball\"],\n)\n\nNameAnalyzer = analyzer(\n    \"normalized_name\",\n    tokenizer=\"lowercase\",\n    filter=[\"standard\", \"lowercase\", \"word_delimiter\"],\n)\n\n\n@doc_type\nclass Project(Document):\n\n    name = Text()\n    normalized_name = Text(analyzer=NameAnalyzer)\n    version = Keyword(multi=True)\n    latest_version = Keyword()\n    summary = Text(analyzer=\"snowball\")\n    description = Text(analyzer=\"snowball\")\n    author = Text()\n    author_email = Text(analyzer=EmailAnalyzer)\n    maintainer = Text()\n    maintainer_email = Text(analyzer=EmailAnalyzer)\n    license = Text()\n    home_page = Keyword()\n    download_url = Keyword()\n    keywords = Text(analyzer=\"snowball\")\n    platform = Keyword()\n    created = Date()\n    classifiers = Keyword(multi=True)\n    zscore = Float()\n\n    @classmethod\n    def from_db(cls, release):\n        obj = cls(meta={\"id\": release.normalized_name})\n        obj[\"name\"] = release.name\n        obj[\"normalized_name\"] = release.normalized_name\n        obj[\"version\"] = sorted(\n            release.all_versions, key=lambda r: packaging.version.parse(r), reverse=True\n        )\n        obj[\"latest_version\"] = release.latest_version\n        obj[\"summary\"] = release.summary\n        obj[\"description\"] = release.description\n        obj[\"author\"] = release.author\n        obj[\"author_email\"] = release.author_email\n        obj[\"maintainer\"] = release.maintainer\n        obj[\"maintainer_email\"] = release.maintainer_email\n        obj[\"home_page\"] = release.home_page\n        obj[\"download_url\"] = release.download_url\n        obj[\"keywords\"] = release.keywords\n        obj[\"platform\"] = release.platform\n        obj[\"created\"] = release.created\n        obj[\"classifiers\"] = release.classifiers\n        obj[\"zscore\"] = release.zscore\n\n        return obj\n\n    class Index:\n        # make sure this class can match any index so it will always be used to\n        # deserialize data coming from elasticsearch.\n        name = \"*\"\n", "path": "warehouse/packaging/search.py"}]}