@Controller @RequestMapping(value="/elasticsearch") public class PuiElasticSearchController extends AbstractPuiController
ID_FUNCTIONALITY_DELETE, ID_FUNCTIONALITY_GET, ID_FUNCTIONALITY_INSERT, ID_FUNCTIONALITY_LIST, ID_FUNCTIONALITY_UPDATE, logger, METHOD_FUNCTIONALITY_DELETE, METHOD_FUNCTIONALITY_GET, METHOD_FUNCTIONALITY_INSERT, METHOD_FUNCTIONALITY_LIST, METHOD_FUNCTIONALITY_UPDATE| Constructor and Description |
|---|
PuiElasticSearchController() |
| Modifier and Type | Method and Description |
|---|---|
Long |
count(String view,
boolean hasLang)
Count the number of registries in the database
|
void |
deleteIndex(String view)
Delete the index represented by the given view
|
void |
document(DocumentOperationType type,
String table,
String pk)
Indicate Elastic Search that a document should be inserted, updated or
deleted from the index.
|
es.prodevelop.pui9.elasticsearch.controllers.PuiElasticSearchController.ElasticInfo |
getInfo()
Get a complete information about the current status of all the indexes of
Elastic Search
|
protected String |
getReadFunctionality() |
protected String |
getWriteFunctionality() |
String |
reindex(String view,
boolean force)
Allow to reindex the index represented by the given view name
|
void |
setActive(Boolean active)
Activate or deactivate Elastic Search for this application
|
void |
setBlocked(String view,
boolean blocked)
Set an index represented by the given view as blocked of unblocked.
|
getDeleteFunctionality, getEventLauncher, getGetFunctionality, getInsertFunctionality, getLanguage, getListFunctionality, getSession, getUpdateFunctionalityprotected String getReadFunctionality()
getReadFunctionality in class AbstractPuiControllerprotected String getWriteFunctionality()
getWriteFunctionality in class AbstractPuiController@GetMapping(value="/reindex",
produces="application/json")
public String reindex(@RequestParam(required=false)
String view,
@RequestParam(required=false)
boolean force)
view - The name of the view you want to reindex the associated index
(or indexes, in case of translated view)force - If set to true, the index will be always reindexed; if set to
false, it will be reindexed only if it's not valid (distinct
number of registries in the database view and in the index)@GetMapping(value="/setActive")
public void setActive(@RequestParam
Boolean active)
active - true to activate; false to deactivate@GetMapping(value="/setBlocked")
public void setBlocked(@RequestParam
String view,
@RequestParam
boolean blocked)
view - The name of the view you want to block or unblock the
associated index (or indexes, in case of translated view)blocked - true to block; false to unblock@DeleteMapping(value="/deleteIndex")
public void deleteIndex(@RequestParam
String view)
throws PuiElasticSearchNoNodesException,
PuiElasticSearchDeleteIndexException
view - The name of the view you want to delete the associated index (or
indexes, in case of translated view)PuiElasticSearchNoNodesException - If Elastic Search is not
connected to any NodePuiElasticSearchDeleteIndexException - If any error occurs while
deleting the Index@PostMapping(value="/document",
consumes="application/json")
public void document(@RequestParam
DocumentOperationType type,
@RequestParam
String table,
@RequestBody
String pk)
throws es.prodevelop.pui9.exceptions.PuiException
It is commonly used in applications that not only the own application manages the used database. This case, the other applications should call this method in order to maintain synchronized the Elastic Search indexes
type - The operation type: insert, update or deletetable - The name of the affected tablepk - The PK of the registry to be processedes.prodevelop.pui9.exceptions.PuiException - If Elastic Search is not enabled for the application; if
the table is not mapped in the code or if the PK is not
well formed for the given table@GetMapping(value="/count",
produces="application/json")
public Long count(@RequestParam
String view,
@RequestParam
boolean hasLang)
throws es.prodevelop.pui9.exceptions.PuiException
view - The view to be checkedhasLang - If want to take into account the languages or notes.prodevelop.pui9.exceptions.PuiException - If an exception occurs while counting@GetMapping(value="/getInfo",
produces="application/json")
public es.prodevelop.pui9.elasticsearch.controllers.PuiElasticSearchController.ElasticInfo getInfo()
throws es.prodevelop.pui9.exceptions.PuiException
es.prodevelop.pui9.exceptions.PuiException - If any error occur while collecting the informationCopyright © 2020. All rights reserved.