### Start Solr with example configuration Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-control-script-reference.html Starts Solr with an example configuration, such as 'schemaless' for schema-less mode. ```bash bin/solr start -e schemaless ``` -------------------------------- ### Start Solr with example configurations Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-control-script-reference.html Use `bin/solr start -e ` to start Solr with an example configuration. The `` can be `cloud`, `techproducts`, `schemaless`, or `films`. The `-f` option is not compatible with `-e`. ```bash bin/solr start -e ``` -------------------------------- ### Start Solr techproducts example Source: https://solr.apache.org/guide/solr/latest/configuration-guide/managed-resources.html Command to start the Solr example named 'techproducts', which is assumed for all examples in this section. ```bash bin/solr start -e techproducts ``` -------------------------------- ### Start Solr with techproducts example Source: https://solr.apache.org/guide/solr/latest/configuration-guide/coreadmin-api.html Starts the Solr example with the techproducts configset, passing an explicit relative path for configSetBaseDir to enable creating new cores using the sample_techproducts_configs configset. ```bash bin/solr start -DconfigSetBaseDir=./server/solr/configsets -e techproducts ``` -------------------------------- ### Node.js: Install dependencies for CBOR example Source: https://solr.apache.org/guide/solr/latest/indexing-guide/indexing-with-cbor.html Command to install the required Node.js packages (cbor and axios) for the CBOR indexing example. ```bash npm install cbor axios ``` -------------------------------- ### Start Solr Source: https://solr.apache.org/guide/solr/latest/query-guide/dense-vector-search.html Starts the Solr server. This is step 5 in the example workflow. ```bash ./bin/solr start ``` -------------------------------- ### START: Start a daemon process - Output Source: https://solr.apache.org/guide/solr/latest/query-guide/stream-api.html Example response confirming the daemon process was started on a specific core. The iteration count is preserved through STOP/START cycles. ```json { "result-set":{ "docs":[{ "DaemonOp":"Deamon:12345 started on gettingstarted_shard2_replica_n4"} ,{ "EOF":true}]}} ``` -------------------------------- ### Start Solr with --no-prompt Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-control-script-reference.html Starts Solr with the cloud example, accepting all defaults without prompting for input. ```bash bin/solr start -e cloud --no-prompt ``` -------------------------------- ### Start and verify solr2 service with systemctl Source: https://solr.apache.org/guide/solr/latest/deployment-guide/taking-solr-to-production.html Starts the solr2 service and checks its status to verify it works correctly after installation. ```bash sudo systemctl start solr2 sudo systemctl status solr2 ``` -------------------------------- ### Python: Install dependencies for CBOR example Source: https://solr.apache.org/guide/solr/latest/indexing-guide/indexing-with-cbor.html Command to install the required Python packages (requests and cbor2) for the CBOR indexing example. ```bash pip install requests cbor2 ``` -------------------------------- ### Add node3 to example cluster Source: https://solr.apache.org/guide/solr/latest/getting-started/tutorial-solrcloud.html Example that adds a node to a cluster started with 'bin/solr start -e cloud'. Creates a Solr home directory and starts a new node on port 8987 with Solr home set to example/cloud/node3/solr. The new node writes its log files to example/cloud/node3/logs. ```bash $ mkdir -p example/cloud/node3/solr $ bin/solr start --solr-home example/cloud/node3/solr -p 8987 -z localhost:9983 ``` -------------------------------- ### Custom setup script with precreate-core Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-in-docker.html Runs a custom command that pre-creates a core, sources a mounted script, and starts Solr in the foreground. ```bash docker run -p 8983:8983 -v $PWD/mysetup.sh:/mysetup.sh --name my_solr solr bash -c "precreate-core gettingstarted && source /mysetup.sh && solr-foreground" ``` -------------------------------- ### Start Solr in cloud mode Source: https://solr.apache.org/guide/solr/latest/getting-started/tutorial-techproducts.html Run this command to start an interactive SolrCloud setup. On Windows, use 'bin\solr.cmd start -e cloud' instead. The '--no-prompt' option is available but not used here because defaults need modification. ```bash $ bin/solr start -e cloud Welcome to the SolrCloud example! This interactive session will help you launch a SolrCloud cluster on your local workstation. To begin, how many Solr nodes would you like to run in your local cluster? (specify 1-4 nodes) [2]: ``` -------------------------------- ### Start Solr techproducts with clustering enabled Source: https://solr.apache.org/guide/solr/latest/query-guide/result-clustering.html Use this command to start the Solr techproducts example with the clustering module and handler enabled. The JVM system properties -Dsolr.modules=clustering and -Dsolr.clustering.enabled=true are required to activate the clustering component. ```bash bin/solr start -e techproducts -Dsolr.modules=clustering -Dsolr.clustering.enabled=true ``` -------------------------------- ### Start Solr with custom memory settings Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-control-script-reference.html Sets the min and max heap size for the JVM. Example sets both to 4g. ```bash bin/solr start -m 4g ``` -------------------------------- ### Start Solr with JVM options Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-control-script-reference.html Starts Solr with additional JVM parameters, such as debugger settings. Wrap parameters in double quotes. Example uses -Xdebug and -Xrunjdwp. ```bash bin/solr start --jvm-opts "-Xdebug -Xrunjdwp:transport=dt_socket, server=y,suspend=n,address=1044" ``` -------------------------------- ### Start Solr with custom solr home Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-control-script-reference.html Sets the solr.solr.home system property to 'newHome'. This parameter is ignored when running examples (-e). ```bash bin/solr start --solr-home newHome ``` -------------------------------- ### Index all example documents with bin/solr post Source: https://solr.apache.org/guide/solr/latest/getting-started/tutorial-techproducts.html Run this command from the Solr install directory to index all files in example/exampledocs into the techproducts collection. The tool automatically detects file types and posts them to the appropriate endpoint. ```bash $ bin/solr post -c techproducts example/exampledocs/* ``` -------------------------------- ### Load example data into Solr container Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-in-docker.html Executes the Solr post tool inside the container to index the example manufacturers.xml document into the 'gettingstarted' core. ```bash docker exec -it my_solr solr post -c gettingstarted example/exampledocs/manufacturers.xml ``` -------------------------------- ### LISTALIASES: Example - Get details for a single alias (Input and Output) Source: https://solr.apache.org/guide/solr/latest/deployment-guide/alias-management.html Example showing the V2 API request to get details for a single alias and the JSON response with name, collections, and properties. ```bash curl -X GET http://localhost:8983/api/aliases/testalias2 ``` ```json { "responseHeader": { "status": 0, "QTime": 1 }, "name": "testalias2", "collections": [ "collection2", "collection1" ], "properties": { "someKey": "someValue" } } ``` -------------------------------- ### Equivalent default start commands Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-control-script-reference.html Shows that the default start command is equivalent to specifying all default options explicitly. ```bash bin/solr start ``` ```bash bin/solr start --host localhost -p 8983 --server-dir server --solr-home solr -m 512m ``` -------------------------------- ### Show Solr installation script help Source: https://solr.apache.org/guide/solr/latest/deployment-guide/taking-solr-to-production.html Displays available options for the Solr installation script, allowing customization of service name, directories, port, and owner. ```bash sudo bash ./install_solr_service.sh --help ``` -------------------------------- ### Start Solr and load data with mounted volume (standalone) Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-in-docker.html Starts a standalone Solr container with a precreated core named 'books', downloads sample data, and posts it using a separate container on the host network. ```bash # start Solr. Listens on localhost:8983 docker run --name my_solr -p 8983:8983 solr solr-precreate books # get data mkdir mydata wget -O mydata/books.csv https://raw.githubusercontent.com/apache/solr/main/solr/example/exampledocs/books.csv docker run --rm -v "$PWD/mydata:/mydata" --network=host solr solr post -c books /mydata/books.csv ``` -------------------------------- ### Response body for GET /schema/managed Source: https://solr.apache.org/guide/solr/latest/configuration-guide/managed-resources.html Example JSON response from the GET /schema/managed endpoint, showing metadata for managed resources such as stopwords and synonyms. ```json { "responseHeader":{ "status":0, "QTime":3 }, "managedResources":[ { "resourceId":"/schema/analysis/stopwords/english", "class":"org.apache.solr.rest.schema.analysis.ManagedWordSetResource", "numObservers":"1" }, { "resourceId":"/schema/analysis/synonyms/english", "class":"org.apache.solr.rest.schema.analysis.ManagedSynonymGraphFilterFactory$SynonymManager", "numObservers":"1" } ] } ``` -------------------------------- ### Show create collection options with bin/solr create --help Source: https://solr.apache.org/guide/solr/latest/deployment-guide/installing-solr.html Displays all available options for creating a new collection. ```bash bin/solr create --help ``` -------------------------------- ### Download and set up Solr 10.0.0 Source: https://solr.apache.org/guide/solr/latest/getting-started/tutorial-aws.html Downloads Solr 10.0.0, extracts it, and sets the SOLR_HOME environment variable, including adding it to .bashrc. ```bash # download desired version of Solr $ wget https://archive.apache.org/dist/solr/solr/10.0.0/solr-10.0.0.tgz # untar the archive $ tar -zxvf solr-10.0.0.tgz # configure SOLR_HOME env variable $ export SOLR_HOME=$PWD/solr-10.0.0 # also add the env variable to .bashrc $ vim ~/.bashrc export SOLR_HOME=/home/ec2-user/solr-10.0.0 ``` -------------------------------- ### GET /stream?action=START&id={id} Source: https://solr.apache.org/guide/solr/latest/query-guide/stream-api.html Starts a previously stopped daemon process. The response reports whether the process was started or not found. ```APIDOC ## GET /stream?action=START&id={id} ### Description Starts a daemon process. The response will either report back the starting of the daemon process, or report it wasn’t found on the specific core that the request was routed to. ### Method GET ### Endpoint /stream?action=START&id={id} ### Parameters #### Query Parameters - **action** (string) - Required - Must be set to `START`. - **id** (string) - Required - The ID of the daemon process to start. ### Response #### Success Response (200) - **result-set** (object) - Contains a `docs` array with the operation result. - **DaemonOp** (string) - A message indicating the daemon was started or not found. #### Response Example { "result-set": { "docs": [ { "DaemonOp": "Deamon:12345 started on gettingstarted_shard2_replica_n4" }, { "EOF": true } ] } } ``` -------------------------------- ### LISTBACKUP V2 API Example Source: https://solr.apache.org/guide/solr/latest/deployment-guide/collection-management.html Example of the V2 API for listing backups. Uses a GET request to the `/api/backups/backupName/versions` endpoint with a `location` parameter. ```bash curl -X GET "http://localhost:8983/api/backups/backupName/versions?location=/path/to/my/shared/drive" ``` -------------------------------- ### CREATE core with configSet (V1 API) Source: https://solr.apache.org/guide/solr/latest/configuration-guide/coreadmin-api.html Creates a new core named 'techproducts_v2' using the existing configSet 'sample_techproducts_configs'. This is the recommended approach when using an existing configSet. ```bash http://localhost:8983/solr/admin/cores?action=CREATE&name=techproducts_v2&configSet=sample_techproducts_configs ``` -------------------------------- ### primes syntax example Source: https://solr.apache.org/guide/solr/latest/query-guide/stream-evaluator-reference.html Returns 100 prime numbers starting from 2000. ```plaintext primes(100, 2000) // returns 100 primes starting from 2000 ``` -------------------------------- ### GET /api/cluster/node-roles/supported - Output Source: https://solr.apache.org/guide/solr/latest/deployment-guide/node-roles.html Example output showing supported roles and modes. ```json { "supported-roles":{ "data":{ "modes":["off", "on"] }, "overseer":{ "modes":["disallowed", "allowed", "preferred"] } } } ``` -------------------------------- ### Start Solr on Windows with bin\solr.cmd start Source: https://solr.apache.org/guide/solr/latest/deployment-guide/installing-solr.html Windows equivalent of starting Solr in the background on port 8983. ```plain bin\solr.cmd start ``` -------------------------------- ### START: Start a daemon process - Input Source: https://solr.apache.org/guide/solr/latest/query-guide/stream-api.html Request to start the daemon process with id '12345'. The response reports success or that the process was not found on the core. ```text http://localhost:8983/solr/gettingstarted/stream?action=START&id=12345 ``` -------------------------------- ### sequence function syntax with example Source: https://solr.apache.org/guide/solr/latest/query-guide/stream-evaluator-reference.html Syntax for the sequence function, which returns an array of numbers. The example shows a sequence of length 100, starting from 0 with a stride of 1. ```plaintext sequence(100, 0, 1) // Returns a sequence of length 100, starting from 0 with a stride of 1. ``` -------------------------------- ### types file example Source: https://solr.apache.org/guide/solr/latest/indexing-guide/filters.html Example of a types file for the 'types' parameter, mapping characters to types like DIGIT and ALPHANUM. Blank lines and lines starting with '#' are ignored. ```text # Don't split numbers at '$', '.' or ',' $ => DIGIT . => DIGIT \u002C => DIGIT # Don't split on ZWJ: https://en.wikipedia.org/wiki/Zero-width_joiner \u200D => ALPHANUM ``` -------------------------------- ### Create core with solr-precreate Source: https://solr.apache.org/guide/solr/latest/deployment-guide/solr-in-docker.html Uses the solr-precreate command to prepare a core and then run Solr in the foreground. ```bash docker run -d -p 8983:8983 --name my_solr solr solr-precreate gettingstarted ``` -------------------------------- ### JSON response for GET stop words Source: https://solr.apache.org/guide/solr/latest/configuration-guide/managed-resources.html Example response body from the GET request. It includes a 'wordSet' object with 'initArgs' (ignoreCase) and a 'managedList' array of stop words. ```json { "responseHeader":{ "status":0, "QTime":1 }, "wordSet":{ "initArgs":{"ignoreCase":true}, "initializedOn":"2014-03-28T20:53:53.058Z", "managedList":[ "a", "an", "and", "are", ] } } ``` -------------------------------- ### explainOther example query Source: https://solr.apache.org/guide/solr/latest/query-guide/common-query-parameters.html Example query using the explainOther parameter to get explain info for documents matching id:juggernaut relative to the main query q=supervillains. ```text q=supervillains&debug=all&explainOther=id:juggernaut ``` -------------------------------- ### GET /api/cluster/node-roles - Output Source: https://solr.apache.org/guide/solr/latest/deployment-guide/node-roles.html Example output showing node roles assignment for all nodes. ```json { "node-roles":{ "data":{ "off":["solr2:8983_solr"], "on":["solr1:8983_solr"] }, "overseer":{ "allowed":["solr1:8983_solr"], "disallowed":[], "preferred":["solr2:8983_solr"] } } } ``` -------------------------------- ### CREATE core from existing files (V1 API) Source: https://solr.apache.org/guide/solr/latest/configuration-guide/coreadmin-api.html Creates a new core from existing core files on disk. The 'instanceDir' must point to a directory containing a 'conf' directory with 'solrconfig.xml' and schema files, unless 'config' and 'schema' parameters are used. ```bash http://localhost:8983/solr/admin/cores?action=CREATE&name=_core-name_&instanceDir=_path/to/dir_&config=solrconfig.xml&dataDir=data ``` -------------------------------- ### LISTBACKUP V1 API Example Source: https://solr.apache.org/guide/solr/latest/deployment-guide/collection-management.html Example of the V1 API for listing backups. The `action=LISTBACKUP` parameter is used with `name` and `location` parameters. This is a GET request to the Solr admin collections endpoint. ```bash http://localhost:8983/solr/admin/collections?action=LISTBACKUP&name=myBackupName&location=/path/to/my/shared/drive ``` -------------------------------- ### COLSTATUS example request Source: https://solr.apache.org/guide/solr/latest/deployment-guide/collection-management.html Example HTTP request to the Solr admin collections API to get collection status with field and size information. Use this to analyze index size and composition. ```http http://localhost:8983/solr/admin/collections?action=COLSTATUS&collection=gettingstarted&fieldInfo=true&sizeInfo=true ``` -------------------------------- ### bin/solr postlogs example with --url and --rootdir Source: https://solr.apache.org/guide/solr/latest/query-guide/logs.html Example command that indexes all log files under /var/logs/solrlogs into the logs collection at http://localhost:8983/solr. ```bash bin/solr postlogs --url http://localhost:8983/solr/logs --rootdir /var/logs/solrlogs ``` -------------------------------- ### Pivot Faceting Query Source: https://solr.apache.org/guide/solr/latest/query-guide/faceting.html Example query using facet.pivot to get pivot faceting results. ```APIDOC ## GET /solr/techproducts/select ### Description Performs a search with pivot faceting on multiple fields. ### Method GET ### Endpoint /solr/techproducts/select ### Parameters #### Query Parameters - **q** (string) - Required - Query string, e.g., `*:*` - **facet.pivot** (string) - Optional - Comma-separated fields for pivot faceting. Multiple values create multiple sections. - **facet.pivot.mincount** (integer) - Optional - Minimum document count for a facet to be included. Default: 1 - **facet** (boolean) - Required - Enables faceting, e.g., `true` - **facet.field** (string) - Optional - Field for standard faceting. - **facet.limit** (integer) - Optional - Maximum number of facet constraints. - **rows** (integer) - Optional - Number of rows to return, e.g., `0` ### Request Example ``` http://localhost:8983/solr/techproducts/select?q=*:*&facet.pivot=cat,popularity,inStock&facet.pivot=popularity,cat&facet=true&facet.field=cat&facet.limit=5&rows=0&facet.pivot.mincount=2 ``` ### Response #### Success Response (200) - **facet_counts** (object) - Contains facet results. - **facet_pivot** (object) - Pivot faceting results. #### Response Example ```json { "facet_counts": { "facet_queries": {}, "facet_fields": { "cat": ["electronics", 14, "currency", 4, "memory", 3, "connector", 2, "graphics card", 2] }, "facet_dates": {}, "facet_ranges": {}, "facet_pivot": { "cat,popularity,inStock": [{ "field": "cat", "value": "electronics", "count": 14, "pivot": [{ "field": "popularity", "value": 6, "count": 5, "pivot": [{ "field": "inStock", "value": true, "count": 5 }] }] }] } } } ``` ```