-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDESK-7278] New Elasticsearch datalayer (#2624)
* Add es async resources * Add resources system * Update es commands * Add 'set_frozeon' to ConfigModel * Add/update tests * Update docs * Update docs * Use latest Elasticsearch 7.x client lib * Improve readability for get_core_schema_from_type function * Rename get_current_app to get_current_async_app
- Loading branch information
1 parent
6f474f9
commit d3dd039
Showing
33 changed files
with
2,990 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
.. core_elastic: | ||
Elasticsearch | ||
============= | ||
|
||
.. module:: superdesk.core.elastic | ||
|
||
ElasticResources Instance | ||
------------------------- | ||
The :class:`ElasticResources <resources.ElasticResources>` instance provides access to the Elasticsearch clients. | ||
This instance is available under the :attr:`SuperdeskAsyncApp.elastic <superdesk.core.app.SuperdeskAsyncApp.elastic>`. | ||
|
||
There are two types of clients you can use: one for standard synchronous connections and another for asynchronous | ||
connections. The functions ending in ``_async`` provide the asynchronous version. | ||
|
||
For example:: | ||
|
||
from superdesk.core.app import get_current_async_app | ||
|
||
def test(): | ||
client = get_current_async_app().elastic.get_client("users") | ||
users = client.search( | ||
{"query": {"term": {"first_name": "monkey"}}} | ||
) | ||
|
||
async def test_async(): | ||
client = get_current_async_app().elastic.get_client_async("users") | ||
users = await client.search( | ||
{"query": {"term": {"first_name": "monkey"}}} | ||
) | ||
|
||
The :attr:`get_client <resources.ElasticResources.get_client>` method returns an instance of | ||
:class:`ElasticResourceClient <sync_client.ElasticResourceClient>`. | ||
|
||
The :attr:`get_client_async <resources.ElasticResources.get_client>` method returns an instance of | ||
:class:`ElasticResourceAsyncClient <async_client.ElasticResourceAsyncClient>`. | ||
|
||
|
||
Elastic References | ||
------------------ | ||
.. autoclass:: superdesk.core.elastic.common.SearchArgs | ||
:member-order: bysource | ||
:members: | ||
|
||
.. autoclass:: superdesk.core.elastic.common.SearchRequest | ||
:member-order: bysource | ||
:members: | ||
|
||
.. autoclass:: superdesk.core.elastic.common.ElasticResourceConfig | ||
:member-order: bysource | ||
:members: | ||
|
||
.. autodata:: superdesk.core.elastic.common.ProjectedFieldArg | ||
|
||
.. autoclass:: superdesk.core.elastic.resources.ElasticResources | ||
:member-order: bysource | ||
:members: | ||
|
||
.. autoclass:: superdesk.core.elastic.sync_client.ElasticResourceClient | ||
:member-order: bysource | ||
:members: | ||
|
||
.. autoclass:: superdesk.core.elastic.async_client.ElasticResourceAsyncClient | ||
:member-order: bysource | ||
:members: | ||
|
||
.. autofunction:: superdesk.core.elastic.mapping.json_schema_to_elastic_mapping | ||
|
||
.. autofunction:: superdesk.core.elastic.mapping.get_elastic_mapping_from_model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.