Maintenance Commands

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
directFileImport Directly import files from local filesystem. Takes four parameters: source for the source path, mode (copy|move), existing (skip|overwrite|rename) and index (true|false)
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.
setUuid Bulk command to set UUIDs on all nodes and relationships which don’t have an id attribute yet.
sync Raw graph data export / import. See How to create a seed file.
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.
deploy Deploys/Exports to/from a target/source directory. See Deployment for more detailed information.
About this article
Last change 2018-12-03
Topics RESTServerStructr 2.0