Maintenance commands are tools for typical administrative tasks to be performed on the server. They offer best performance and support bulk operations. The available maintenance commands implemented in the integrated REST server are listed in the table below and can be executed by making a HTTP POST request to the maintenance resource, followed by the command name.

POST /structr/rest/maintenance/clearDatabase '{}'

or with parameters:

POST /structr/rest/maintenance/rebuildIndex '{"type": "Page", "mode": "nodesOnly"}'

Command Description
importGist Import an AsciiDoc document with included Cypher statements, also known as “GraphGist”. The Cypher statements will be executed, the text portions are ignored. After importing the document, Structr runs a schema auto-detection process to analyze the data created via Cypher and infer a data model.
importRdf Import an RDF document. After importing the document, Structr runs a schema auto-detection process to analyze data created based on the imported RDF document and infer a data model.
rebuildIndex Rebuild the internal fulltext, keyword and spatial indexes. Takes three optional parameters: type to limit the execution to a certain node type, relType to limit to a certain relationship type, and mode (can be nodesOnly or relsOnly to rebuild the index only for nodes or relationships.
rebuildIndexForType Rebuild indexes for the specified type only.
createLabels Create node labels. Takes an optional parameter type to specify a type to limit creation of labels to this node type.
clearDatabase Empty the database.
fixNodeProperties Tries to fix properties in the database that have been stored there with the wrong type.
setNodeProperties Bulk command to set property values on all nodes of a certain type.
Mandatory parameter type: The database type on which the properties should be set.
Reserved word newType is used to update the type property of nodes (because type is already taken)
Note: If this command is used to change the type property of nodes, the createLabels command has to be called afterwards to update the labels of the changed nodes - otherwise they will not be accessible.
changeNodePropertyKey Bulk command to migrate property names.
setRelationshipProperties Bulk command to set relationship property values on all relationships of a certain type.
copyRelationshipProperties Bulk command to copy relationship property values.
deleteSoftDeletedNodes Bulk command to remove nodes flagged with the deleted boolean attribute.
setUuid Bulk command to set UUIDs on all nodes and relationships which don’t have an id attribute yet.
sync Synchronize graph data between Structr instances.
snapshot Create a schema snapshot and write it to a local file on the server the Structr instance is running on.
flushCaches Flush second-level caches.
moveUnusedFiles Move files not referenced by a database node to a target directory. Takes two optional parameters: mode (can be log or move) and target which can be an absolute or a relative path (relative to the standard files/ directory). Default (without parameters) is log only. It is recommended to issue a rebuildIndex command first to be sure that unused files are detected correctly.
deploy Deploys/Exports to/from a target/source directory. See Deployment for more detailed information.

Graph-Browser

Related Articles
About this article
Last change 2017-05-04
Topics RESTServerStructr 2.0