diff --git a/dev-docs/ref-guide/asciidoc-syntax.adoc b/dev-docs/ref-guide/asciidoc-syntax.adoc index 2b590e145ef8..a5445a398de0 100644 --- a/dev-docs/ref-guide/asciidoc-syntax.adoc +++ b/dev-docs/ref-guide/asciidoc-syntax.adoc @@ -79,15 +79,38 @@ More info: https://docs.asciidoctor.org/asciidoc/latest/verbatim/source-blocks/ === Source Block Syntax Highlighting -The HTML output uses Rouge to add syntax highlighting to code examples. +The HTML output uses https://highlightjs.org/[highlight.js] to add syntax highlighting to code examples. This is done by adding the language of the code block after the `source`, as shown in the above example source block (`xml` in that case). -Rouge has a long selection of lexers available. -You can see the full list at https://github.com/rouge-ruby/rouge/wiki/List-of-supported-languages-and-lexers. -Use one of the valid short names to get syntax highlighting for that language. +Only the languages in the highlight.js build of the Guide's UI bundle are highlighted. +A block with any other language name is shown without highlighting, and the browser console logs a warning. +Adding a language is a change to the UI bundle, not to the pages. -Ideally, we will have an appropriate lexer to use for all source blocks, but that's not possible. +Use `text` for output and for anything that needs no highlighting; `plain` and `nohighlight` behave the same. When in doubt, choose `text`, or leave it blank. +Commands are the exception: see <>. + +=== Command Blocks + +Use the same block style for every `curl`, `bin/solr` or other shell command, so readers see one convention across the Guide: + +* A block with commands only uses `bash` and no prompt, so it can be copied as is. +* A block that also shows the output of the commands uses `console`, with `$` at the start of each command line, so the commands stand out from the output. +The copy button of the Guide copies only the `$` lines of such a block, so a command whose argument continues on the next lines without a trailing `\` (a multi-line JSON body) belongs in a `bash` block instead. +* A block that shows output alone uses `text`. +* The Windows variant of a command uses `powershell`, which the highlight.js build does not include yet, so it is shown without highlighting. + +.Example Command Blocks +[source] +---- +[source,bash] +curl "http://localhost:8983/solr/films/select?q=*:*" + +[,console] +$ bin/solr create -c films --shards 2 --replication-factor 2 +Creating new collection 'films' using command: +http://localhost:7574/solr/admin/collections?action=CREATE&name=films&numShards=2&replicationFactor=2&collection.configName=films +---- === Importing Code Snippets from Other Files diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/configsets-api.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/configsets-api.adoc index e7373f7c9de6..80620400138e 100644 --- a/solr/solr-ref-guide/modules/configuration-guide/pages/configsets-api.adoc +++ b/solr/solr-ref-guide/modules/configuration-guide/pages/configsets-api.adoc @@ -178,7 +178,7 @@ With the v1 API, the `upload` command must be capitalized as `UPLOAD`: [source,bash] ---- -$ (cd solr/server/solr/configsets/sample_techproducts_configs/conf && zip -r - *) > myconfigset.zip +(cd solr/server/solr/configsets/sample_techproducts_configs/conf && zip -r - *) > myconfigset.zip curl "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=myConfigSet" --header "Content-Type:application/octet-stream" --data-binary @myconfigset.zip ---- @@ -187,7 +187,7 @@ The same can be achieved using a Unix pipe with a single request as follows: [source,bash] ---- -$ (cd server/solr/configsets/sample_techproducts_configs/conf && zip -r - *) | curl "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=myConfigSet" --header "Content-Type:application/octet-stream" --data-binary @- +(cd server/solr/configsets/sample_techproducts_configs/conf && zip -r - *) | curl "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=myConfigSet" --header "Content-Type:application/octet-stream" --data-binary @- ---- ==== @@ -198,7 +198,7 @@ With the v2 API, the name of the configset to upload is provided as a path param [source,bash] ---- -$ (cd solr/server/solr/configsets/sample_techproducts_configs/conf && zip -r - *) > myconfigset.zip +(cd solr/server/solr/configsets/sample_techproducts_configs/conf && zip -r - *) > myconfigset.zip curl -X PUT --header "Content-Type:application/octet-stream" --data-binary @myconfigset.zip "http://localhost:8983/api/configsets/myConfigSet" diff --git a/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager.adoc b/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager.adoc index 93c5d5882a85..75eb491c0654 100644 --- a/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager.adoc +++ b/solr/solr-ref-guide/modules/configuration-guide/pages/package-manager.adoc @@ -46,7 +46,7 @@ To enable it, start all Solr nodes with the `-Dsolr.packages.enabled=true` param [source,bash] ---- -$ bin/solr start -Dsolr.packages.enabled=true +bin/solr start -Dsolr.packages.enabled=true ---- WARNING: There are security consequences to enabling the package manager. @@ -62,7 +62,7 @@ In order to install packages into Solr, one has to add a repository hosting the [source,bash] ---- -$ bin/solr package add-repo +bin/solr package add-repo ---- NOTE: Do not add repositories that you don't trust or control. @@ -74,21 +74,21 @@ To list installed packages: [source,bash] ---- -$ bin/solr package list-installed +bin/solr package list-installed ---- To list packages available for installation from added repositories: [source,bash] ---- -$ bin/solr package list-available +bin/solr package list-available ---- To install a package, coping over the artifacts from the repository into Solr's internal package store and setting up classloader for this package to be used: [source,bash] ---- -$ bin/solr package install [:] +bin/solr package install [:] ---- === Deploy a Package @@ -102,21 +102,21 @@ There are two ways to do this: either use the CLI's `deploy` command or manually If the package author states support for it, the package can be deployed with the CLI's `deploy` command. [source,bash] ---- -$ bin/solr package deploy :[version] --collections [,,...] [--param = --param = ... +bin/solr package deploy :[version] --collections [,,...] [--param = --param = ... ---- or [source,bash] ---- -$ bin/solr package deploy :[version] --cluster +bin/solr package deploy :[version] --cluster ---- If the package accepts parameters for its setup commands, they can be specified (as per package documentation): [source,bash] ---- -$ bin/solr package deploy --param = --param = +bin/solr package deploy --param = --param = ---- The author may want you to confirm deployment of a package via a prompt. @@ -151,7 +151,7 @@ After deploying, verify that the collection is using the package: [source,bash] ---- -$ bin/solr package list-deployed -c +bin/solr package list-deployed -c ---- === Updating Packages @@ -162,7 +162,7 @@ Next, install the new version of the package from the repositories. [source,bash] ---- -$ bin/solr package install : +bin/solr package install : ---- Once you have installed the new version, you can selectively update each of your collections or the cluster level plugins. @@ -170,12 +170,12 @@ Assuming the old version is `1.0.0` of the package `mypackage`, and the new vers [source,bash] ---- -$ bin/solr package deploy mypackage:2.0.0 --update --collections mycollection +bin/solr package deploy mypackage:2.0.0 --update --collections mycollection ---- or [source,bash] ---- -$ bin/solr package deploy mypackage:2.0.0 --update --cluster +bin/solr package deploy mypackage:2.0.0 --update --cluster ---- You can run the `list-deployed` command to verify that this collection is using the newly added version. @@ -186,7 +186,7 @@ If a package supports undeploying the plugins it contains (check package author' [source,bash] ---- -$ bin/solr package undeploy --collections [,,...] +bin/solr package undeploy --collections [,,...] ---- === Uninstall a Package @@ -195,14 +195,14 @@ If a package has been undeployed or was never deployed, then it can be uninstall [source,bash] ---- -$ bin/solr package uninstall : +bin/solr package uninstall : ---- or [source,bash] ---- -$ bin/solr package deploy : --cluster +bin/solr package deploy : --cluster ---- Both package name and version are required. diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/enabling-ssl.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/enabling-ssl.adoc index 92e5af2d8f50..27b02b71415e 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/enabling-ssl.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/enabling-ssl.adoc @@ -39,9 +39,9 @@ The `-ext SAN=...` `keytool` option allows you to specify all the DNS names and/ In addition to `localhost` and `127.0.0.1`, this example includes a LAN IP address `192.168.1.3` for the machine the Solr nodes will be running on: -[source,terminal] +[source,bash] ---- -$ keytool -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass secret -storepass secret -validity 9999 -keystore solr-ssl.keystore.p12 -storetype PKCS12 -ext SAN=DNS:localhost,IP:192.168.1.3,IP:127.0.0.1 -dname "CN=localhost, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country" +keytool -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass secret -storepass secret -validity 9999 -keystore solr-ssl.keystore.p12 -storetype PKCS12 -ext SAN=DNS:localhost,IP:192.168.1.3,IP:127.0.0.1 -dname "CN=localhost, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country" ---- The above command will create a keystore file named `solr-ssl.keystore.p12` in the current directory. @@ -50,16 +50,16 @@ The above command will create a keystore file named `solr-ssl.keystore.p12` in t Convert the PKCS12 format keystore, including both the certificate and the key, into PEM format using the http://www.openssl.org[`openssl`] command: -[source,terminal] +[source,bash] ---- -$ openssl pkcs12 -in solr-ssl.keystore.p12 -out solr-ssl.pem +openssl pkcs12 -in solr-ssl.keystore.p12 -out solr-ssl.pem ---- If you want to use curl on OS X Yosemite (10.10), you'll need to create a certificate-only version of the PEM format, as follows: -[source,terminal] +[source,bash] ---- -$ openssl pkcs12 -nokeys -in solr-ssl.keystore.p12 -out solr-ssl.cacert.pem +openssl pkcs12 -nokeys -in solr-ssl.keystore.p12 -out solr-ssl.cacert.pem ---- === Set Common SSL-Related Environment Variables @@ -148,9 +148,9 @@ If you created the SSL key without all DNS names or IP addresses on which Solr n *nix:: + ==== -[source,terminal] +[source,bash] ---- -$ bin/solr start --solr-home cloud/node1 -z server1:2181,server2:2181,server3:2181 -p 8984 +bin/solr start --solr-home cloud/node1 -z server1:2181,server2:2181,server3:2181 -p 8984 ---- ==== @@ -159,7 +159,7 @@ Windows:: ==== [source,powershell] ---- -C:\> bin\solr.cmd --solr-home cloud\node1 -z server1:2181,server2:2181,server3:2181 +bin\solr.cmd --solr-home cloud\node1 -z server1:2181,server2:2181,server3:2181 ---- ==== @@ -175,9 +175,9 @@ Customize the values for the parameters shown as needed and add any used in your *nix:: + ==== -[source,terminal] +[source,bash] ---- -$ bin/solr start -p 8984 +bin/solr start -p 8984 ---- ==== @@ -186,7 +186,7 @@ Windows:: ==== [source,powershell] ---- -C:\> bin\solr.cmd -p 8984 +bin\solr.cmd -p 8984 ---- ==== ====== @@ -244,7 +244,7 @@ bin/solr create -c mycollection --shards 2 Windows:: + ==== -[source,text] +[source,powershell] ---- bin\solr.cmd create -c mycollection --shards 2 ---- @@ -257,7 +257,7 @@ The `create` action will pass the `SOLR_SSL_*` properties set in your include fi To get the resulting cluster status (again, if you have not enabled client authentication, remove the `-E solr-ssl.pem:secret` option): -[source,terminal] +[source,bash] ---- curl -E solr-ssl.pem:secret --cacert solr-ssl.pem "https://localhost:8984/solr/admin/collections?action=CLUSTERSTATUS&indent=on" ---- @@ -301,9 +301,9 @@ You should get a response that looks like this: Use `bin/solr post` to index some example documents to the SolrCloud collection created above: -[source,console] +[source,bash] ---- -$ bin/solr post --solr-url https://localhost:8984 --name mycollection example/exampledocs/*.xml +bin/solr post --solr-url https://localhost:8984 --name mycollection example/exampledocs/*.xml ---- === Query Using curl @@ -311,7 +311,7 @@ $ bin/solr post --solr-url https://localhost:8984 --name mycollection example/ex Use curl to query the SolrCloud collection created above, from a directory containing the PEM formatted certificate and key created above (e.g., `example/etc/`). If you have not enabled client authentication (system property `-Djetty.ssl.clientAuth=true)`, then you can remove the `-E solr-ssl.pem:secret` option: -[source,console] +[source,bash] ---- curl -E solr-ssl.pem:secret --cacert solr-ssl.pem "https://localhost:8984/solr/mycollection/select?q=*:*" ---- diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc index 2f8b7f0550bd..5808c53dbd70 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/installing-solr.adoc @@ -171,7 +171,7 @@ bin/solr start If you are running Windows, you can start Solr by running `bin\solr.cmd` instead. -[source,plain] +[source,powershell] ---- bin\solr.cmd start ---- diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/node-roles.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/node-roles.adoc index 07dab503bddb..ae4825a988a6 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/node-roles.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/node-roles.adoc @@ -107,7 +107,7 @@ Dedicated *`coordinator`* nodes can be provisioned with enough memory but very l Fetches the list of supported roles and their supported modes for this cluster. *Input* -[source,text] +[source,bash] ---- curl http://localhost:8983/api/cluster/node-roles/supported ---- @@ -135,7 +135,7 @@ curl http://localhost:8983/api/cluster/node-roles/supported Fetches the current node roles assignment for all the nodes in the cluster. *Input* -[source,text] +[source,bash] ---- curl http://localhost:8983/api/cluster/node-roles ---- @@ -206,7 +206,7 @@ http://localhost:8983/api/cluster/node-roles/role/data/off Fetches the current node roles assignment for the specified node. *Input* -[source,text] +[source,bash] ---- curl http://localhost:8983/api/cluster/node-roles/node/solr1:8983_solr ---- diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc index d7a7c47cb733..de678a1c1207 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-control-script-reference.adoc @@ -456,7 +456,7 @@ Stop Solr with verbose messages from this script. The `--version` command simply returns the version of Solr currently installed and immediately exists. -[source,bash] +[source,console] ---- $ bin/solr --version X.Y.0 @@ -519,7 +519,7 @@ ERROR: Directory /opt/bin/solr does not exist. The basic usage of `bin/solr assert` is: -[source, plain] +[source,console] ---- $ bin/solr assert -h usage: bin/solr assert [--cloud ] [--exists ] [--exitcode] [-h] [--message ] [--not-cloud @@ -1217,7 +1217,7 @@ The operations are available as sub-commands, which each have their own set of o The basic usage of bin/solr zk is: -[source,plain] +[source,console] ---- $ bin/solr zk -h Usage: solr zk upconfig|downconfig -d -n [-z zkHost] [-s solrUrl] @@ -1934,35 +1934,35 @@ Notice the different endpoints used depending on the format. First export the documents, making sure to ignore any fields that are populated via a `copyField` by specifying what fields you want to export: -[,console] +[,bash] ---- -$ bin/solr export --solr-url http://localhost:8983 -c gettingstarted --fields id,name,manu,cat,features +bin/solr export --solr-url http://localhost:8983 -c gettingstarted --fields id,name,manu,cat,features ---- Create a new collection to import the exported documents into: -[,console] +[,bash] ---- -$ bin/solr create -c test_collection -n techproducts +bin/solr create -c test_collection -n techproducts ---- Now import the data with either of these methods: -[,console] +[,bash] ---- curl 'http://localhost:8983/solr/test_collection/update/json/docs?commit=true' --header "Content-Type: application/json" -d @gettingstarted.json ---- or -[,console] +[,bash] ---- curl 'http://localhost:8983/solr/test_collection/update?commit=true' -H 'Content-Type: application/json' -d @gettingstarted.json ---- *Example: import `javabin` files* -[,console] +[,bash] ---- -$ bin/solr export --solr-url http://localhost:8983 -c gettingstarted --format javabin --fields id,name,manu,cat,features +bin/solr export --solr-url http://localhost:8983 -c gettingstarted --format javabin --fields id,name,manu,cat,features curl 'http://localhost:8983/solr/test_collection/update?commit=true' --header "Content-Type: application/javabin" --data-binary @gettingstarted.javabin ---- @@ -2035,36 +2035,36 @@ Learn more about on the xref:backup-restore.adoc[Backup and Restore] and xref:co To create a snapshot you just give it the collection and the name you want: -[,console] +[,bash] ---- -$ bin/solr snapshot-create -c --snapshot-name + bin/solr snapshot-create -c --snapshot-name ---- === List all available snapshots To list all the snapshots that have been taken for a collection: -[,console] +[,bash] ---- -$ bin/solr snapshot-list -c +bin/solr snapshot-list -c ---- === Detailed information about a Snapshot Use the describe command to gain detailed information about a specific snapshot: -[,console] +[,bash] ---- -$ bin/solr snapshot-describe -c --snapshot-name +bin/solr snapshot-describe -c --snapshot-name ---- === Backing up a Collection Use the export command to back up a collection: -[,console] +[,bash] ---- -$ bin/solr snapshot-export [--backup-repo-name ] -c --dest-dir [--async-id ] +bin/solr snapshot-export [--backup-repo-name ] -c --dest-dir [--async-id ] ---- The backup is named after the collection and the time the command ran, and the name is printed when the export starts. @@ -2079,7 +2079,7 @@ Doing that required the non-incremental backup format, which was removed in Solr Use the delete command to delete a snapshot : -[,console] +[,bash] ---- -$ bin/solr snapshot-delete -c --snapshot-name +bin/solr snapshot-delete -c --snapshot-name ---- diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/system-requirements.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/system-requirements.adoc index 7bc04774a701..7413835fde41 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/system-requirements.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/system-requirements.adoc @@ -30,7 +30,7 @@ Solr is tested on several versions of Linux, macOS and Windows. You will need the Java Runtime Environment (JRE) version 21 or higher. At a command line, check your Java version like this: -[source,bash] +[source,console] ---- $ java -version openjdk version "11.0.14.1" 2022-02-08 diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-access-control.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-access-control.adoc index b7b095c4bd8b..ea991101d971 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-access-control.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/zookeeper-access-control.adoc @@ -434,7 +434,7 @@ Then run the command below appropriate for your operating system: ==== [source,bash] ---- -$ bin/solr zk updateacls /zk-path +bin/solr zk updateacls /zk-path ---- ==== @@ -443,7 +443,7 @@ Windows:: ==== [source,powershell] ---- -$ bin/solr.cmd zk updateacls /zk-path +bin/solr.cmd zk updateacls /zk-path ---- ==== ====== diff --git a/solr/solr-ref-guide/modules/getting-started/pages/solr-tutorial.adoc b/solr/solr-ref-guide/modules/getting-started/pages/solr-tutorial.adoc index 4f3a1f333ff1..da8764cdf5ee 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/solr-tutorial.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/solr-tutorial.adoc @@ -92,10 +92,10 @@ Nice work! As you work through this tutorial, you may want to stop Solr and reset the environment back to the starting point. The following command line will stop Solr and remove the directories for each of the two nodes that were created all the way back in Exercise 1: -[,console] +[,bash] ---- -$ bin/solr stop --all -$ rm -Rf example/cloud/ +bin/solr stop --all +rm -Rf example/cloud/ ---- == Where to next? diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-aws.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-aws.adoc index b1d07c5516d5..5dcdd2bbeb26 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-aws.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-aws.adoc @@ -123,27 +123,27 @@ You cannot use the instances until they become *“running”*. + Using SSH, if your AWS identity key file is `aws-key.pem` and the AMI uses `ec2-user` as login user, on each AWS instance, do the following: + -[,console] +[,bash] ---- -$ ssh-add aws-key.pem -$ ssh -A ec2-user@ +ssh-add aws-key.pem +ssh -A ec2-user@ ---- + . While logged in to each of the AWS EC2 instances, configure Java 21 and download Solr: + -[,console] +[,bash] ---- # check if the AWS instance already has java installed -$ java -version +java -version # install JDK 21 -$ sudo yum install java-21 +sudo yum install java-21 # configure JDK 21 as the default -$ sudo /usr/sbin/alternatives --config java +sudo /usr/sbin/alternatives --config java # verify that the default java version is now 21 -$ java -version +java -version ---- + [,console,subs="attributes"] @@ -201,22 +201,22 @@ See xref:deployment-guide:securing-solr.adoc#network-configuration[Network Confi + Inside the `ec2-101-1-2-3.us-east-2.compute.amazonaws.com` (`solr-node-1`) + -[,console] +[,bash] ---- -$ cd $SOLR_HOME +cd $SOLR_HOME # start Solr node on 8983 and ZooKeeper will start on 9983 (8983+1000) -$ bin/solr start -p 8983 --host solr-node-1 +bin/solr start -p 8983 --host solr-node-1 ---- + On the other node, `ec2-101-4-5-6.us-east-2.compute.amazonaws.com` (`solr-node-2`) + -[,console] +[,bash] ---- -$ cd $SOLR_HOME +cd $SOLR_HOME # start Solr node on 8983 and connect to ZooKeeper running on first node -$ bin/solr start -p 8983 --host solr-node-2 -z solr-node-1:9983 +bin/solr start -p 8983 --host solr-node-2 -z solr-node-1:9983 ---- . Inspect and Verify. @@ -263,13 +263,13 @@ See the section xref:deployment-guide:zookeeper-ensemble.adoc[] for information In this example we're using ZooKeeper v{dep-version-zookeeper}. On the node you're using to host ZooKeeper (`zookeeper-node`), download the package and untar it: + -[,console,subs="attributes"] +[,bash,subs="attributes"] ---- # download stable version of ZooKeeper -$ wget https://archive.apache.org/dist/zookeeper/zookeeper-{dep-version-zookeeper}/apache-zookeeper-{dep-version-zookeeper}-bin.tar.gz +wget https://archive.apache.org/dist/zookeeper/zookeeper-{dep-version-zookeeper}/apache-zookeeper-{dep-version-zookeeper}-bin.tar.gz # untar the archive -$ tar -zxvf apache-zookeeper-{dep-version-zookeeper}-bin.tar.gz +tar -zxvf apache-zookeeper-{dep-version-zookeeper}-bin.tar.gz ---- + Add an environment variable for ZooKeeper's home directory (`ZOO_HOME`) to the `.bashrc` for the user who will be running the process. @@ -278,7 +278,7 @@ Correct the path to the ZooKeeper installation as appropriate if where you put i + [source,bash,subs="attributes"] ---- -$ export ZOO_HOME=$PWD/apache-zookeeper-{dep-version-zookeeper}-bin +export ZOO_HOME=$PWD/apache-zookeeper-{dep-version-zookeeper}-bin # put the env variable in .bashrc # vim ~/.bashrc @@ -286,20 +286,20 @@ export ZOO_HOME=/home/ec2-user/apache-zookeeper-{dep-version-zookeeper}-bin ---- . Change directories to `ZOO_HOME`, and create the ZooKeeper configuration by using the template provided by ZooKeeper. + -[,console] +[,bash] ---- -$ cd $ZOO_HOME +cd $ZOO_HOME # create ZooKeeper config by using zoo_sample.cfg -$ cp conf/zoo_sample.cfg conf/zoo.cfg +cp conf/zoo_sample.cfg conf/zoo.cfg ---- . Create the ZooKeeper data directory in the filesystem, and edit the `zoo.cfg` file to uncomment the autopurge parameters and define the location of the data directory. + [source,bash] ---- # create data dir for ZooKeeper, edit zoo.cfg, uncomment autopurge parameters -$ mkdir data -$ vim conf/zoo.cfg +mkdir data +vim conf/zoo.cfg # -- uncomment -- autopurge.snapRetainCount=3 @@ -313,32 +313,32 @@ dataDir=data ---- . Start ZooKeeper. + -[,console] +[,bash] ---- -$ cd $ZOO_HOME +cd $ZOO_HOME # start ZooKeeper, default port: 2181 -$ bin/zkServer.sh start +bin/zkServer.sh start ---- . On the first node being used for Solr (`solr-node-1`), start Solr and tell it where to find ZooKeeper. + -[,console] +[,bash] ---- -$ cd $SOLR_HOME +cd $SOLR_HOME # start Solr node on 8983 and connect to ZooKeeper running on ZooKeeper node -$ bin/solr start -p 8983 --host solr-node-1 -z zookeeper-node:2181 +bin/solr start -p 8983 --host solr-node-1 -z zookeeper-node:2181 ---- + . On the second Solr node (`solr-node-2`), again start Solr and tell it where to find ZooKeeper. + -[,console] +[,bash] ---- -$ cd $SOLR_HOME +cd $SOLR_HOME # start Solr node on 8983 and connect to ZooKeeper running on ZooKeeper node -$ bin/solr start -p 8983 --host solr-node-2 -z zookeeper-node:2181 +bin/solr start -p 8983 --host solr-node-2 -z zookeeper-node:2181 ---- [TIP] diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-diy.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-diy.adoc index 2fa35587de9f..6bf3aed867fd 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-diy.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-diy.adoc @@ -44,7 +44,7 @@ docker run --rm -p 9998:9998 --name tika -d apache/tika:3.2.3.0-full === Start Solr with the extraction module enabled -[,console] +[,bash] ---- # Stop Solr if it is running bin/solr stop --all @@ -58,9 +58,9 @@ bin/solr start -Dsolr.modules=extraction Before you get started, create a new collection, named whatever you'd like. In this example, the collection will be named "localDocs"; replace that name with whatever name you choose if you want to. -[,console] +[,bash] ---- -$ bin/solr create -c localDocs --shards 2 -rf 2 +bin/solr create -c localDocs --shards 2 -rf 2 ---- Again, as we saw from Exercise 2 above, this will use the `_default` configset and all the schemaless features it provides. @@ -71,7 +71,7 @@ You may need to iterate on indexing a few times before you get the schema right. Add the /update/extract handler to your collection, pointing to the Tika Server you just started -[,console] +[,bash] ---- curl 'http://localhost:8983/solr/localDocs/config' -H 'Content-type:application/json' -d '{ "add-requesthandler": { @@ -97,9 +97,9 @@ We used only JSON, XML and CSV in our exercises, but the Post command can also h In this example, assume there is a directory named "Documents" locally. To index it, we would issue a command like this (correcting the collection name after the `-c` parameter as needed): + -[,console] +[,bash] ---- -$ bin/solr post -c localDocs ~/Documents +bin/solr post -c localDocs ~/Documents ---- + You may get errors as it works through your documents. @@ -140,16 +140,16 @@ We can use `bin/solr post` to delete documents also if we structure the request Execute the following command to delete a specific document: -[,console] +[,bash] ---- -$ bin/solr post -c localDocs --mode args "{delete: {id:'SP2514N'}}" +bin/solr post -c localDocs --mode args "{delete: {id:'SP2514N'}}" ---- To delete all documents, you can use "delete-by-query" command like: -[,console] +[,bash] ---- -$ bin/solr post -c localDocs --mode args "{delete: {query:'*:*'}}" +bin/solr post -c localDocs --mode args "{delete: {query:'*:*'}}" ---- You can also modify the above to only delete documents that match a specific query. diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-films.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-films.adoc index 39816098cc26..4a321e45cd9e 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-films.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-films.adoc @@ -30,17 +30,17 @@ Then go ahead to the next section. If you did, though, and need to restart Solr, issue these commands: -[,console] +[,bash] ---- -$ bin/solr start -p 8983 --solr-home example/cloud/node1/solr +bin/solr start -p 8983 --solr-home example/cloud/node1/solr ---- This starts the first node. When it's done start the second node, and tell it how to connect to ZooKeeper: -[,console] +[,bash] ---- -$ bin/solr start -p 7574 --solr-home example/cloud/node2/solr -z localhost:9983 +bin/solr start -p 7574 --solr-home example/cloud/node2/solr -z localhost:9983 ---- NOTE: If you have defined `ZK_HOST` in `solr.in.sh`/`solr.in.cmd` (see xref:deployment-guide:zookeeper-ensemble#updating-solr-include-files[Updating Solr Include Files]) you can omit `-z ` from the above command. @@ -73,9 +73,9 @@ This time, we're going to use a configset that has a very minimal schema and let The data you're going to index is related to movies, so start by creating a collection named "films" that uses the `_default` configset: -[,console] +[,bash] ---- -$ bin/solr create -c films --shards 2 --replication-factor 2 +bin/solr create -c films --shards 2 --replication-factor 2 ---- Whoa, wait. @@ -88,7 +88,7 @@ This is equivalent to the options we had during the interactive example from the You should see output like: -[,console] +[,text] ---- WARNING: Using _default configset. Data driven schema functionality is enabled by default, which is NOT RECOMMENDED for production use. @@ -166,7 +166,7 @@ That's not going to get us very far. What we can do is set up the "name" field in Solr before we index the data to be sure Solr always interprets it as a string. At the command line, enter this curl command: -[,console] +[,bash] ---- curl 'http://localhost:8983/solr/films/schema' -H 'Content-type:application/json' --data-binary '{"add-field": {"name":"name", "type":"text_general", "multiValued":false, "stored":true}}' ---- @@ -195,7 +195,7 @@ You can use either the Admin UI or the Schema API for this. At the command line, use the Schema API again to define a copy field: -[,console] +[,bash] ---- curl 'http://localhost:8983/solr/films/schema' -H 'Content-type:application/json' --data-binary '{"add-copy-field" : {"source":"*","dest":"_text_"}}' ---- @@ -217,34 +217,36 @@ OK, now we're ready to index the data and start playing around with it. The films data we will index is located in the `example/films` directory of your installation. It comes in three formats: JSON, XML and CSV. -Pick one of the formats and index it into the "films" collection (in each example, one command is for Unix/MacOS and the other is for Windows): +Pick one of the formats and index it into the "films" collection: -.To Index JSON Format -[tabs#index-json] +[tabs#index-film-data] ====== +JSON:: ++ +==== +[source,bash] ---- -$ bin/solr post -c films example/films/films.json +bin/solr post -c films example/films/films.json ---- -====== +==== - -.To Index XML Format -[tabs#index-xml] -====== -[,console] +XML:: ++ +==== +[source,bash] ---- -$ bin/solr post -c films example/films/films.xml +bin/solr post -c films example/films/films.xml ---- -====== - +==== -.To Index CSV Format -[tabs#index-csv] -====== -[,console] +CSV:: ++ +==== +[source,bash] ---- -$ bin/solr post -c films example/films/films.csv --params "f.genre.split=true&f.directed_by.split=true&f.genre.separator=|&f.directed_by.separator=|" +bin/solr post -c films example/films/films.csv --params "f.genre.split=true&f.directed_by.split=true&f.genre.separator=|&f.directed_by.separator=|" ---- +==== ====== Each command includes these main parameters: @@ -299,7 +301,7 @@ To see facet counts from all documents (`q=\*:*`): turn on faceting (`facet=true If you only want facets, and no document contents, specify `rows=0`. The `curl` command below will return facet counts for the `genre_str` field: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/films/select?q=\*:*&rows=0&facet=true&facet.field=genre_str" ---- @@ -340,7 +342,7 @@ Or, perhaps you do want all the facets, and you'll let your application's front- If you wanted to control the number of items in a bucket, you could do something like this: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/films/select?=&q=\*:*&facet.field=genre_str&facet.mincount=200&facet=on&rows=0" ---- @@ -360,7 +362,7 @@ The Solr Admin UI doesn't yet support range facet options, so you will need to u If we construct a query that looks like this: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/films/select?q=*:*&rows=0\ &facet=true\ @@ -430,7 +432,7 @@ Another faceting type is pivot facets, also known as "decision trees", allowing Using the films data, pivot facets can be used to see how many of the films in the "Drama" category (the `genre_str` field) are directed by a director. Here's how to get at the raw data for this scenario: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/films/select?q=\*:*&rows=0&facet=on&facet.pivot=genre_str,directed_by_str" ---- @@ -486,7 +488,7 @@ Like our previous exercise, this data may not be relevant to your needs. We can clean up our work by deleting the collection. To do that, issue this command at the command line: -[,console] +[,bash] ---- -$ bin/solr delete -c films +bin/solr delete -c films ---- diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc index fe9698e7ee5a..be4c3370177c 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-five-minutes.adoc @@ -24,9 +24,9 @@ To launch Solr, run: `bin/solr start` on Unix or MacOS; `bin\solr.cmd start` on To start another Solr node and have it join the cluster alongside the first node, -[,console] +[,bash] ---- -$ bin/solr start -z localhost:9983 -p 8984 +bin/solr start -z localhost:9983 -p 8984 ---- @@ -34,7 +34,7 @@ $ bin/solr start -z localhost:9983 -p 8984 Like a database system holds data in tables, Solr holds data in collections. A collection can be created as follows: -[,console] +[,bash] ---- curl --request POST \ --url http://localhost:8983/api/collections \ @@ -50,7 +50,7 @@ curl --request POST \ Let us define some of the fields that our documents will contain. -[,console] +[,bash] ---- curl --request POST \ --url http://localhost:8983/api/collections/techproducts/schema \ @@ -74,7 +74,7 @@ curl --request POST \ A single document can be indexed as: -[,console] +[,bash] ---- curl --request POST \ --url 'http://localhost:8983/api/collections/techproducts/update' \ @@ -95,7 +95,7 @@ curl --request POST \ Multiple documents can be indexed in the same request: -[,console] +[,bash] ---- curl --request POST \ --url 'http://localhost:8983/api/collections/techproducts/update' \ @@ -131,7 +131,7 @@ curl --request POST \ A file containing the documents can be indexed as follows: -[,console] +[,bash] ---- curl -H "Content-Type: application/json" \ -X POST \ @@ -142,7 +142,7 @@ curl -H "Content-Type: application/json" \ == Commit the Changes After documents are indexed into a collection, they are not immediately available for searching. In order to have them searchable, a commit operation (also called `refresh` in other search engines like OpenSearch etc.) is needed. Commits can be scheduled at periodic intervals using auto-commits as follows. -[,console] +[,bash] ---- curl 'http://localhost:8983/api/collections/techproducts/config' -H 'Content-type: application/json' -d '{"set-property":{"updateHandler.autoCommit.maxTime":15000}}' ---- @@ -150,7 +150,7 @@ curl 'http://localhost:8983/api/collections/techproducts/config' -H 'Content-typ == Make some Basic search queries You can now try searching your documents like: -[source] +[source,bash] ---- curl 'http://localhost:8983/solr/techproducts/select?q=name%3Alightning' ---- diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-opennlp.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-opennlp.adoc index bb39d6fb5d25..b31430a6c602 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-opennlp.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-opennlp.adoc @@ -36,10 +36,10 @@ It predicts the sentiment of the review as a number of stars (between 1 and 5). To enable NLP processing in Solr, start Solr with the `analysis-extras` module and package support: -[,console] +[,bash] ---- -$ export SOLR_SECURITY_MANAGER_ENABLED=false -$ bin/solr start -m 4g -Dsolr.modules=analysis-extras -Dsolr.packages.enabled=true +export SOLR_SECURITY_MANAGER_ENABLED=false +bin/solr start -m 4g -Dsolr.modules=analysis-extras -Dsolr.packages.enabled=true ---- [NOTE] @@ -56,11 +56,11 @@ For sentiment analysis, we need two essential files: Let's create a directory for our models and download them: -[,console] +[,bash] ---- -$ mkdir -p ./downloads/sentiment/ -$ wget -O ./downloads/sentiment/model.onnx https://huggingface.co/onnx-community/bert-base-multilingual-uncased-sentiment-ONNX/resolve/main/onnx/model_quantized.onnx -$ wget -O ./downloads/sentiment/vocab.txt https://huggingface.co/onnx-community/bert-base-multilingual-uncased-sentiment-ONNX/raw/main/vocab.txt +mkdir -p ./downloads/sentiment/ +wget -O ./downloads/sentiment/model.onnx https://huggingface.co/onnx-community/bert-base-multilingual-uncased-sentiment-ONNX/resolve/main/onnx/model_quantized.onnx +wget -O ./downloads/sentiment/vocab.txt https://huggingface.co/onnx-community/bert-base-multilingual-uncased-sentiment-ONNX/raw/main/vocab.txt ---- If you do not have `wget` installed you will need to adjust the above command or download manually. @@ -81,16 +81,16 @@ Learn more about ONNX at https://onnx.ai[onnx.ai^, role="external", window="_bla Create a new collection for our sentiment analysis experiments: -[,console] +[,bash] ---- -$ bin/solr create -c sentiment +bin/solr create -c sentiment ---- === Step 4: Configure the Schema We need to add fields to our schema to store both the input text and the sentiment classification results: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/schema" -H 'Content-type:application/json' --data-binary '{ "add-field":{ @@ -100,7 +100,7 @@ curl "http://localhost:8983/solr/sentiment/schema" -H 'Content-type:application/ }' ---- -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/schema" -H 'Content-type:application/json' --data-binary '{ "add-field":{ @@ -114,12 +114,12 @@ curl "http://localhost:8983/solr/sentiment/schema" -H 'Content-type:application/ Solr's FileStore provides a distributed file storage mechanism for SolrCloud. Upload our model files there: -[,console] +[,bash] ---- curl --data-binary @./downloads/sentiment/vocab.txt -X PUT "http://localhost:8983/api/cluster/filestore/files/models/sentiment/vocab.txt" ---- -[,console] +[,bash] ---- curl --data-binary @./downloads/sentiment/model.onnx -X PUT "http://localhost:8983/api/cluster/filestore/files/models/sentiment/model.onnx" ---- @@ -136,7 +136,7 @@ When you reference these files in configuration, you use paths relative to the F Now we'll configure the update processor that will analyze sentiment during document indexing: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/config" -H 'Content-type:application/json' -d '{ "add-updateprocessor": { @@ -178,7 +178,7 @@ This configuration creates an update processor that: Let's index some sample documents to see the sentiment analysis in action: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/update/json?processor=sentimentClassifier&commit=true" -H 'Content-type:application/json' -d '[ { @@ -198,7 +198,7 @@ Notice that we specify the processor name with `processor=sentimentClassifier` i Query the documents to see the sentiment classifications: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/select?q=id:good" ---- @@ -220,7 +220,7 @@ You should see the positive review classified as "very good": Check the negative review: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/select?q=id:bad" ---- @@ -355,7 +355,7 @@ For a permanent configuration, define an update processor chain in `solrconfig.x You can then use this chain by default or explicitly reference it when indexing: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/update/json?update.chain=sentiment-analysis-chain" -d '...' ---- @@ -366,7 +366,7 @@ curl "http://localhost:8983/solr/sentiment/update/json?update.chain=sentiment-an Create facets based on sentiment to understand opinion distribution: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/select?q=*:*&facet=true&facet.field=name_sentiment" ---- @@ -375,7 +375,7 @@ curl "http://localhost:8983/solr/sentiment/select?q=*:*&facet=true&facet.field=n Filter search results to show only documents with specific sentiment: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/select?q=product_type:electronics&fq=name_sentiment:very%20good" ---- @@ -384,7 +384,7 @@ curl "http://localhost:8983/solr/sentiment/select?q=product_type:electronics&fq= Boost documents with positive sentiment in search results: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/select?q=*:*&defType=edismax&bq=name_sentiment:very%20good^5.0" ---- @@ -393,7 +393,7 @@ curl "http://localhost:8983/solr/sentiment/select?q=*:*&defType=edismax&bq=name_ Analyze sentiment trends over time using time-based queries and facets: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/sentiment/select?q=*:*&facet=true&facet.range=timestamp&facet.range.start=NOW/DAY-30DAY&facet.range.end=NOW&facet.range.gap=%2B1DAY&facet.pivot=timestamp,name_sentiment" ---- @@ -457,7 +457,7 @@ This integration demonstrates how Solr can leverage modern NLP capabilities to e When you're done with this tutorial, stop Solr: -[,console] +[,bash] ---- -$ bin/solr stop --all +bin/solr stop --all ---- diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-paramsets.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-paramsets.adoc index 797c21ca4ec2..645e19fc7e49 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-paramsets.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-paramsets.adoc @@ -30,15 +30,15 @@ Then go ahead to the next section. === Create a New Collection -[,console] +[,bash] ---- -$ bin/solr create -c films +bin/solr create -c films ---- Because we didn't specify a ConfigSet, we will end up using the `_default` ConfigSet. We'll specify the specific schema for a couple of fields that Solr would otherwise guess differently (than we'd like) about: -[,console] +[,bash] ---- curl http://localhost:8983/solr/films/schema -H 'Content-type:application/json' --data-binary '{ "add-field" : [ @@ -69,9 +69,9 @@ and for the release date also to be single valued. Now that we have updated our Schema, we need to index the sample film data, or, if you already have indexed it, then re-index it to take advantage of the new field definitions we added. -[,console] +[,bash] ---- -$ bin/solr post -c films example/films/films.json +bin/solr post -c films example/films/films.json ---- === Let's get Searching! @@ -87,14 +87,14 @@ http://localhost:8983/solr/films/query?q=name:batman Show me all 'Super hero' movies: -[,console] +[,bash] ---- curl 'http://localhost:8983/solr/films/query?q=*:*&fq=genre:"Superhero movie"' ---- Let's see the distribution of genres across all the movies. See the facet section of the response for the counts: -[,console] +[,bash] ---- curl 'http://localhost:8983/solr/films/query?q=*:*&facet=true&facet.field=genre' ---- @@ -113,7 +113,7 @@ That is clearly not related to any Harry Potter movies. Let's set up two relevancy algorithms, using our APIs, and then compare the quality of the results. Algorithm *A* will specify using `dismax` and a `qf` parameter, while Algorithm *B* will use `dismax`, `qf` and a must match `mm` set to 100%. -[,console] +[,bash] ---- curl http://localhost:8983/solr/films/config/params -H 'Content-type:application/json' --data-binary '{ "set": { diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-solrcloud.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-solrcloud.adoc index 348dfeee00aa..192671490537 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-solrcloud.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-solrcloud.adoc @@ -50,16 +50,16 @@ For more details see the section xref:deployment-guide:securing-solr.adoc#networ The `bin/solr` script makes it easy to get started with SolrCloud as it walks you through the process of launching Solr nodes in SolrCloud mode and adding a collection. To get started, simply do: -[,console] +[,bash] ---- -$ bin/solr start -e cloud +bin/solr start -e cloud ---- This starts an interactive session to walk you through the steps of setting up a simple SolrCloud cluster with embedded ZooKeeper. The script starts by asking you how many Solr nodes you want to run in your local cluster, with the default being 2. -[console] +[,text] ---- Welcome to the SolrCloud example! @@ -72,7 +72,7 @@ These nodes will each exist on a single machine, but will use different ports to Next, the script will prompt you for the port to bind each of the Solr nodes to, such as: -[,console] +[,text] ---- Please enter the port for node1 [8983] ---- @@ -80,9 +80,9 @@ Next, the script will prompt you for the port to bind each of the Solr nodes to, Choose any available port for each node; the default for the first node is 8983 and 7574 for the second node. The script will start each node in order and show you the command it uses to start the server, such as: -[,console] +[,bash] ---- -$ bin/solr start --solr-home example/cloud/node1/solr -p 8983 +bin/solr start --solr-home example/cloud/node1/solr -p 8983 ---- The first node will also start an embedded ZooKeeper server bound to port 9983. @@ -90,7 +90,7 @@ The Solr home for the first node is in `example/cloud/node1/solr` as indicated b After starting up all nodes in the cluster, the script prompts you for the name of the collection to create: -[,console] +[,text] ---- Please provide a name for your new collection: [gettingstarted] ---- @@ -115,7 +115,7 @@ This can be done as follows (assuming your collection name is `mycollection`): V1 API:: + ==== -[,console] +[,bash] ---- curl http://host:8983/solr/{collectionName}/config -d '{"set-user-property": {"update.autoCreateFields":"false"}}' ---- @@ -124,7 +124,7 @@ curl http://host:8983/solr/{collectionName}/config -d '{"set-user-property": {"u V2 API:: + ==== -[,console] +[,bash] ---- curl http://host:8983/api/collections/{collectionName}/config -d '{"set-user-property": {"update.autoCreateFields":"false"}}' ---- @@ -134,9 +134,9 @@ curl http://host:8983/api/collections/{collectionName}/config -d '{"set-user-pro At this point, you should have a new collection created in your local SolrCloud cluster. To verify this, you can run the status command: -[,console] +[,bash] ---- -$ bin/solr status +bin/solr status ---- If you encounter any errors during this process, check the Solr log files in `example/cloud/node1/logs` and `example/cloud/node2/logs`. @@ -144,9 +144,9 @@ If you encounter any errors during this process, check the Solr log files in `ex You can see how your collection is deployed across the cluster by visiting the cloud panel in the Solr Admin UI: http://localhost:8983/solr/#/~cloud. Solr also provides a way to perform basic diagnostics for a collection using the healthcheck command: -[,console] +[,bash] ---- -$ bin/solr healthcheck -c gettingstarted +bin/solr healthcheck -c gettingstarted ---- The healthcheck command gathers basic information about each replica in a collection, such as number of docs, current status (active, down, etc.), and address (where the replica lives in the cluster). @@ -155,18 +155,18 @@ Documents can now be added to SolrCloud using the xref:indexing-guide:post-comma To stop Solr in SolrCloud mode, you would use the `bin/solr` script and issue the `stop` command, as in: -[,console] +[,bash] ---- -$ bin/solr stop --all +bin/solr stop --all ---- === Starting with --no-prompt You can also get SolrCloud started with all the defaults instead of the interactive session using the following command: -[,console] +[,bash] ---- -$ bin/solr start -e cloud --no-prompt +bin/solr start -e cloud --no-prompt ---- === Restarting Nodes @@ -174,16 +174,16 @@ $ bin/solr start -e cloud --no-prompt You can restart your SolrCloud nodes using the `bin/solr` script. For instance, to restart node1 running on port 8983 (with an embedded ZooKeeper server), you would do: -[,console] +[,bash] ---- -$ bin/solr restart -p 8983 --solr-home example/cloud/node1/solr +bin/solr restart -p 8983 --solr-home example/cloud/node1/solr ---- To restart node2 running on port 7574, you can do: -[,console] +[,bash] ---- -$ bin/solr restart -p 7574 -z localhost:9983 --solr-home example/cloud/node2/solr +bin/solr restart -p 7574 -z localhost:9983 --solr-home example/cloud/node2/solr ---- Notice that you need to specify the ZooKeeper address (`-z localhost:9983`) when starting node2 so that it can join the cluster with node1. @@ -193,20 +193,20 @@ Notice that you need to specify the ZooKeeper address (`-z localhost:9983`) when Adding a node to an existing cluster is a bit advanced and involves a little more understanding of Solr. Once you start a SolrCloud cluster using the startup scripts, you can add a new node to it by: -[,console] +[,bash] ---- -$ mkdir -$ bin/solr start --solr-home /solr -p -z +mkdir +bin/solr start --solr-home /solr -p -z ---- Notice that the above requires you to create a Solr home directory. Example (with directory structure) that adds a node to an example started with "bin/solr start -e cloud": -[,console] +[,bash] ---- -$ mkdir -p example/cloud/node3/solr -$ bin/solr start --solr-home example/cloud/node3/solr -p 8987 -z localhost:9983 +mkdir -p example/cloud/node3/solr +bin/solr start --solr-home example/cloud/node3/solr -p 8987 -z localhost:9983 ---- The previous command will start another Solr node on port 8987 with Solr home set to `example/cloud/node3/solr`. diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adoc index dc93e58e9716..e0b537d375d6 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adoc @@ -40,7 +40,7 @@ The first prompt asks how many nodes we want to run. Note the `[2]` at the end of the last line; that is the default number of nodes. Two is what we want for this example, so you can simply press kbd:[enter]. -[,console] +[,text] ---- Ok, let's start up 2 Solr nodes for your example SolrCloud cluster. Please enter the port for node1 [8983]: @@ -50,7 +50,7 @@ This will be the port that the first node runs on. Unless you know you have something else running on port 8983 on your machine, accept this default option also by pressing kbd:[enter]. If something is already using that port, you will be asked to choose another port. -[,console] +[,text] ---- Please enter the port for node2 [7574]: ---- @@ -62,7 +62,7 @@ If something is already using that port, you will be asked to choose another por Solr will now initialize itself and start running on those two nodes. The script will print the commands it uses for your reference. -[,console] +[,text] ---- Starting up 2 Solr nodes for your example SolrCloud cluster. @@ -91,7 +91,7 @@ Because we are starting in SolrCloud mode, and did not define any details about After startup is complete, you'll be prompted to create a collection to use for indexing data. -[,console] +[,text] ---- Now let's create a new collection for indexing documents in your 2-node cluster. Please provide a name for your new collection: [gettingstarted] @@ -102,7 +102,7 @@ This tutorial will ask you to index some sample data included with Solr, called Let's name our collection "techproducts" so it's easy to differentiate from other collections we'll create later. Enter `techproducts` at the prompt and hit kbd:[enter]. -[,console] +[,text] ---- How many shards would you like to split techproducts into? [2] ---- @@ -111,7 +111,7 @@ This is asking how many xref:solr-glossary.adoc#shard[shards] you want to split Choosing "2" (the default) means we will split the index relatively evenly across both nodes, which is a good way to start. Accept the default by hitting kbd:[enter]. -[,console] +[,text] ---- How many replicas per shard would you like to create? [2] ---- @@ -119,7 +119,7 @@ How many replicas per shard would you like to create? [2] A replica is a copy of the index that's used for failover (see also the xref:solr-glossary.adoc#replica[Solr Glossary definition]). Again, the default of "2" is fine to start with here also, so accept the default by hitting kbd:[enter]. -[,console] +[,text] ---- Please choose a configuration for the techproducts collection, available options are: _default or sample_techproducts_configs [_default] @@ -135,7 +135,7 @@ This configset is specifically designed to support the sample data we want to us At this point, Solr will create the collection and again output to the screen the commands it issues. -[,console] +[,text] ---- Created collection 'techproducts' with 2 shard(s), 2 replica(s) with config-set 'techproducts' @@ -167,14 +167,14 @@ You'll need a command shell to run some of the following examples, rooted in the The data we will index is in the `example/exampledocs` directory. The documents are in a mix of document formats (JSON, CSV, etc.), and fortunately we can index them all at once: -[,console] +[,bash] ---- -$ bin/solr post -c techproducts example/exampledocs/* +bin/solr post -c techproducts example/exampledocs/* ---- You should see output similar to the following: -[,console] +[,text] ---- Posting files to [base] url http://localhost:8983/solr/techproducts/update... Entering auto mode. File endings considered are xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log @@ -220,7 +220,7 @@ If you click on it, your browser will show you the raw response. To use curl, give the same URL shown in your browser in quotes on the command line: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/techproducts/select?indent=on&q=*:*" ---- @@ -241,7 +241,7 @@ Enter "foundation" and hit btn:[Execute Query] again. If you prefer curl, enter something like this: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/techproducts/select?q=foundation" ---- @@ -289,7 +289,7 @@ This is one of the available fields on the query form in the Admin UI. Put "id" (without quotes) in the "fl" box and hit btn:[Execute Query] again. Or, specify it with curl: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/techproducts/select?q=foundation&fl=id" ---- @@ -386,7 +386,7 @@ For example, search for "CAS latency" by entering that phrase in quotes to the ` If you're following along with curl, note that the space between terms must be converted to "+" in a URL, as so: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/techproducts/select?q=\"CAS+latency\"" ---- @@ -447,7 +447,7 @@ To find documents that contain both terms "electronics" and "music", enter `+ele If you're using curl, you must encode the `+` character because it has a reserved purpose in URLs (encoding the space character). The encoding for `+` is `%2B` as in: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/techproducts/select?q=%2Belectronics%20%2Bmusic" ---- @@ -457,7 +457,7 @@ You should only get a single result. To search for documents that contain the term "electronics" but *don't* contain the term "music", enter `+electronics -music` in the `q` box in the Admin UI. For curl, again, URL encode `+` as `%2B` as in: -[,console] +[,bash] ---- curl "http://localhost:8983/solr/techproducts/select?q=%2Belectronics+-music" ---- @@ -477,23 +477,23 @@ You can choose now to continue to the next example which will introduce more Sol If you decide not to continue with this tutorial, the data we've indexed so far is likely of little value to you. You can delete your installation and start over, or you can use the `bin/solr` script we started out with to delete this collection: -[,console] +[,bash] ---- -$ bin/solr delete -c techproducts +bin/solr delete -c techproducts ---- And then create a new collection: -[,console] +[,bash] ---- -$ bin/solr create -c --shards 2 -rf 2 +bin/solr create -c --shards 2 -rf 2 ---- To stop both of the Solr nodes we started, issue the command: -[,console] +[,bash] ---- -$ bin/solr stop --all +bin/solr stop --all ---- For more information on start/stop and collection options with `bin/solr`, see xref:deployment-guide:solr-control-script-reference.adoc[]. diff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-vectors.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-vectors.adoc index d131a6d3eff3..982b5045b78a 100644 --- a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-vectors.adoc +++ b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-vectors.adoc @@ -30,16 +30,16 @@ Then go ahead to the next section. === Preparing for the Vector data -[,console] +[,bash] ---- -$ bin/solr create -c films +bin/solr create -c films ---- Because we didn't specify a ConfigSet when we created the collection, we will use the `_default` ConfigSet. First we need to update our schema to add the vector field type, the field to hold the vector values and some supporting fields. -[,console] +[,bash] ---- curl http://localhost:8983/solr/films/schema -H 'Content-type:application/json' --data-binary '{ "add-field-type" : { @@ -75,9 +75,9 @@ curl http://localhost:8983/solr/films/schema -H 'Content-type:application/json' We have the vectors embedded in our `films.json` file, so let's index that data, taking advantage of our new schema field we just defined. -[,console] +[,bash] ---- -$ bin/solr post -c films example/films/films.json +bin/solr post -c films example/films/films.json ---- === Let's do some Vector searches diff --git a/solr/solr-ref-guide/modules/indexing-guide/pages/indexing-with-tika.adoc b/solr/solr-ref-guide/modules/indexing-guide/pages/indexing-with-tika.adoc index ea87b8344c7b..dffd6e6c9ad8 100644 --- a/solr/solr-ref-guide/modules/indexing-guide/pages/indexing-with-tika.adoc +++ b/solr/solr-ref-guide/modules/indexing-guide/pages/indexing-with-tika.adoc @@ -143,9 +143,9 @@ Note this includes the path, so if you upload a different file, always be sure t You can also use `bin/solr post` to do the same thing: -[,console] +[,bash] ---- -$ bin/solr post -c gettingstarted example/exampledocs/solr-word.pdf --params "literal.id=doc1" +bin/solr post -c gettingstarted example/exampledocs/solr-word.pdf --params "literal.id=doc1" ---- Now you can execute a query and find that document with a request like `\http://localhost:8983/solr/gettingstarted/select?q=pdf`. @@ -163,9 +163,9 @@ The dynamic field `ignored_*` is good for this purpose. For the fields you do want to map, explicitly set them using `fmap.IN=OUT` and/or ensure the field is defined in the schema. Here's an example: -[,console] +[,bash] ---- -$ bin/solr post -c gettingstarted example/exampledocs/solr-word.pdf --params "literal.id=doc1&uprefix=ignored_&fmap.last_modified=last_modified_dt" +bin/solr post -c gettingstarted example/exampledocs/solr-word.pdf --params "literal.id=doc1&uprefix=ignored_&fmap.last_modified=last_modified_dt" ---- [NOTE] @@ -606,18 +606,18 @@ If `literalsOverride=false`, literals will be appended as multi-value to the Tik The command below captures `

` tags separately (`capture=h1`), and then maps all the instances of that field to a dynamic field named `foo_t` (`fmap.h1=foo_t`). -[,console] +[,bash] ---- -$ bin/solr post -c gettingstarted example/exampledocs/sample.html --params "literal.id=doc2&captureAttr=true&defaultField=_text_&fmap.h1=foo_t&capture=h1" +bin/solr post -c gettingstarted example/exampledocs/sample.html --params "literal.id=doc2&captureAttr=true&defaultField=_text_&fmap.h1=foo_t&capture=h1" ---- === Using Literals to Define Custom Metadata To add in your own metadata, pass in the literal parameter along with the file: -[,console] +[,bash] ---- -$ bin/solr post -c gettingstarted --params "literal.id=doc4&captureAttr=true&defaultField=text&capture=div&fmap.div=foo_t&literal.blah_s=Bah" example/exampledocs/sample.html +bin/solr post -c gettingstarted --params "literal.id=doc4&captureAttr=true&defaultField=text&capture=div&fmap.div=foo_t&literal.blah_s=Bah" example/exampledocs/sample.html ---- The parameter `literal.blah_s=Bah` will insert a field `blah_s` into every document. @@ -627,9 +627,9 @@ Every instance of the text will be "Bah". The example below passes in an XPath expression to restrict the XHTML returned by Tika: -[,console] +[,bash] ---- -$ bin/solr post -c gettingstarted --params "literal.id=doc5&captureAttr=true&defaultField=text&capture=h1&fmap.h1=foo_t&xpath=/xhtml:html/xhtml:body/xhtml:h1//node()" example/exampledocs/sample.html +bin/solr post -c gettingstarted --params "literal.id=doc5&captureAttr=true&defaultField=text&capture=h1&fmap.h1=foo_t&xpath=/xhtml:html/xhtml:body/xhtml:h1//node()" example/exampledocs/sample.html ---- === Extracting Data without Indexing @@ -646,9 +646,9 @@ curl "http://localhost:8983/solr/gettingstarted/update/extract?&extractOnly=true The output includes XML generated by Tika (and further escaped by Solr's XML) using a different output format to make it more readable (`-out yes` instructs the tool to echo Solr's output to the console): -[,console] +[,bash] ---- -$ bin/solr post -c gettingstarted --params "extractOnly=true&wt=json&indent=true" --verbose example/exampledocs/sample.html +bin/solr post -c gettingstarted --params "extractOnly=true&wt=json&indent=true" --verbose example/exampledocs/sample.html ---- === Using Solr Cell with a POST Request diff --git a/solr/solr-ref-guide/modules/indexing-guide/pages/post-command.adoc b/solr/solr-ref-guide/modules/indexing-guide/pages/post-command.adoc index b7a8cfb87386..b25f10be35f4 100644 --- a/solr/solr-ref-guide/modules/indexing-guide/pages/post-command.adoc +++ b/solr/solr-ref-guide/modules/indexing-guide/pages/post-command.adoc @@ -23,9 +23,9 @@ NOTE: This tool is meant for use by new users exploring Solr's capabilities, and To run it, open a window and enter: -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8983 --name gettingstarted example/films/films.json +bin/solr post --solr-url http://localhost:8983 --name gettingstarted example/films/films.json ---- This will contact the server at `localhost:8983`. @@ -84,41 +84,41 @@ This section presents several examples. Index all JSON files into `gettingstarted`. -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8983 --name gettingstarted *.json +bin/solr post --solr-url http://localhost:8983 --name gettingstarted *.json ---- === Indexing XML Add all documents with file extension `.xml` to the collection named `gettingstarted`. -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8983 --name gettingstarted *.xml +bin/solr post --solr-url http://localhost:8983 --name gettingstarted *.xml ---- Add all documents starting with `article` with file extension `.xml` to the `gettingstarted` collection on Solr running on port `8984`. -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8984 --name gettingstarted article*.xml +bin/solr post --solr-url http://localhost:8984 --name gettingstarted article*.xml ---- Send XML arguments to delete a document from `gettingstarted`. -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8983 --name gettingstarted --mode args --type application/xml '42' +bin/solr post --solr-url http://localhost:8983 --name gettingstarted --mode args --type application/xml '42' ---- === Indexing CSV and JSON Index all CSV and JSON files into `gettingstarted` from current directory: -[,console] +[,bash] ---- -$ bin/solr post -c gettingstarted --filetypes json,csv . +bin/solr post -c gettingstarted --filetypes json,csv . ---- `--filetypes` also applies to files named on the command line, including a shell-expanded `*`. @@ -126,9 +126,9 @@ A file with any other extension is skipped with a warning, unless `--type` is se Index a tab-separated file into `gettingstarted`: -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8984 --name signals --params "separator=%09" --type text/csv data.tsv +bin/solr post --solr-url http://localhost:8984 --name signals --params "separator=%09" --type text/csv data.tsv ---- The content type (`-type`) parameter is required to treat the file as the proper type, otherwise it will be ignored and a WARNING logged as it does not know what type of content a .tsv file is. @@ -140,32 +140,32 @@ Index a PDF file into `gettingstarted`. NOTE: This requires a Tika Server to be configured. See xref:indexing-with-tika.adoc#tika-server[Indexing With Tika] for details. -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8983/solr --name gettingstarted a.pdf +bin/solr post --solr-url http://localhost:8983/solr --name gettingstarted a.pdf ---- Automatically detect content types in a folder, and recursively scan it for documents for indexing into `gettingstarted`. -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8983 --name gettingstarted afolder/ +bin/solr post --solr-url http://localhost:8983 --name gettingstarted afolder/ ---- Automatically detect content types in a folder, but limit it to PPT and HTML files and index into `gettingstarted`. -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8983 --name gettingstarted --filetypes ppt,html afolder/ +bin/solr post --solr-url http://localhost:8983 --name gettingstarted --filetypes ppt,html afolder/ ---- === Indexing to a Password Protected Solr (Basic Auth) Index a PDF as the user "solr" with password "SolrRocks": -[,console] +[,bash] ---- -$ bin/solr post -u solr:SolrRocks --solr-url http://localhost:8983 --name gettingstarted a.pdf +bin/solr post -u solr:SolrRocks --solr-url http://localhost:8983 --name gettingstarted a.pdf ---- === Crawling a Website to Index Documents @@ -174,9 +174,9 @@ Crawl the Apache Solr website going one layer deep and indexing the pages into S See xref:indexing-with-tika.adoc#trying-out-solr-cell[Trying Out Solr Cell] to learn more about setting up Solr for extracting content from web pages. -[,console] +[,bash] ---- -$ bin/solr post --mode web -c gettingstarted --recursive 1 --delay 1 https://solr.apache.org/ +bin/solr post --mode web -c gettingstarted --recursive 1 --delay 1 https://solr.apache.org/ ---- === Standard Input as Source for Indexing @@ -184,16 +184,16 @@ $ bin/solr post --mode web -c gettingstarted --recursive 1 --delay 1 https://sol You can use the standard input as your source for data to index. Notice the `--verbose` providing raw responses from Solr. -[,console] +[,bash] ---- -$ echo '{commit: {}}' | bin/solr post --mode stdin --solr-url http://localhost:8983 --name my_collection --verbose +echo '{commit: {}}' | bin/solr post --mode stdin --solr-url http://localhost:8983 --name my_collection --verbose ---- === Raw Data as Source for Indexing Provide the raw document as a string for indexing. -[,console] +[,bash] ---- -$ bin/solr post --solr-url http://localhost:8983 --name signals -mode args --type text/csv --verbose $'id,value\n1,0.47' +bin/solr post --solr-url http://localhost:8983 --name signals -mode args --type text/csv --verbose $'id,value\n1,0.47' ---- diff --git a/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc b/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc index 1e6f873fa39b..283a219cca45 100644 --- a/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc +++ b/solr/solr-ref-guide/modules/query-guide/pages/dense-vector-search.adoc @@ -187,12 +187,15 @@ JSON:: ==== [source,json] ---- -[{ "id": "1", -"vector": [1.0, 2.5, 3.7, 4.1] -}, -{ "id": "2", -"vector": [1.5, 5.5, 6.7, 65.1] -} +[ + { + "id": "1", + "vector": [1.0, 2.5, 3.7, 4.1] + }, + { + "id": "2", + "vector": [1.5, 5.5, 6.7, 65.1] + } ] ---- ==== @@ -203,20 +206,20 @@ XML:: [source,xml] ---- - -1 -1.0 -2.5 -3.7 -4.1 - - -2 -1.5 -5.5 -6.7 -65.1 - + + 1 + 1.0 + 2.5 + 3.7 + 4.1 + + + 2 + 1.5 + 5.5 + 6.7 + 65.1 + ---- ==== @@ -251,12 +254,15 @@ JSON:: ==== [source,json] ---- -[{ "id": "1", - "vector_multivalued": [[1.0, 2.0, 3.0, 4.0],[5.0, 6.0, 7.0, 8.0]] -}, -{ "id": "2", - "vector_multivalued": [[1.0, 2.0, 3.0, 4.0],[5.0, 6.0, 7.0, 8.0]] -} +[ + { + "id": "1", + "vector_multivalued": [[1.0, 2.0, 3.0, 4.0],[5.0, 6.0, 7.0, 8.0]] + }, + { + "id": "2", + "vector_multivalued": [[1.0, 2.0, 3.0, 4.0],[5.0, 6.0, 7.0, 8.0]] + } ] ---- ==== @@ -966,12 +972,15 @@ JSON:: ==== [source,json] ---- -[{ "id": "1", -"my_late_vector": "[[1.0, 2, 3.7, 4.1], [2.2, -2.5, 7.3, 4.0]]", -}, -{ "id": "2", -"my_late_vector": "[[2.0, 5.6, -3.2, 1.4], [7.8, -2.5, 3.7, 0.0034], [-2.2, 5.5, 0.6, -0.030]]" -} +[ + { + "id": "1", + "my_late_vector": "[[1.0, 2, 3.7, 4.1], [2.2, -2.5, 7.3, 4.0]]" + }, + { + "id": "2", + "my_late_vector": "[[2.0, 5.6, -3.2, 1.4], [7.8, -2.5, 3.7, 0.0034], [-2.2, 5.5, 0.6, -0.030]]" + } ] ---- ==== @@ -982,14 +991,14 @@ XML:: [source,xml] ---- - -1 -[[1.0, 2, 3.7, 4.1], [2.2, -2.5, 7.3, 4.0]] - - -2 -[[2.0, 5.6, -3.2, 1.4], [7.8, -2.5, 3.7, 0.0034], [-2.2, 5.5, 0.6, -0.030]] - + + 1 + [[1.0, 2, 3.7, 4.1], [2.2, -2.5, 7.3, 4.0]] + + + 2 + [[2.0, 5.6, -3.2, 1.4], [7.8, -2.5, 3.7, 0.0034], [-2.2, 5.5, 0.6, -0.030]] + ---- ==== @@ -1246,21 +1255,21 @@ EOF . Start Solr + -[source,sh] +[source,bash] ---- ./bin/solr start ---- . Upload the configset and create a collection + -[source,sh] +[source,bash] ---- ./bin/solr zk upconfig -n cuvs_vectors -d cuvs_configset/conf && ./bin/solr create -c vectors -n cuvs_vectors ---- . Index documents + -[source,sh] +[source,bash] ---- curl -s "http://localhost:8983/solr/vectors/update?commit=true" \ -H "Content-Type: application/json" \ @@ -1275,7 +1284,7 @@ curl -s "http://localhost:8983/solr/vectors/update?commit=true" \ . Query the index + -[source,sh] +[source,bash] ---- curl -s 'http://localhost:8983/solr/vectors/select?q=%7B!knn%20f=article_vector%20topK=1%7D%5B0.84393,0.50073,0.57059,0.89899,-0.08722,0.26803,0.00807,0.09877%5D&fl=id,score&rows=3&omitHeader=true' ---- diff --git a/solr/solr-ref-guide/modules/query-guide/pages/pagination-of-results.adoc b/solr/solr-ref-guide/modules/query-guide/pages/pagination-of-results.adoc index 769744887ea9..765f27dcd844 100644 --- a/solr/solr-ref-guide/modules/query-guide/pages/pagination-of-results.adoc +++ b/solr/solr-ref-guide/modules/query-guide/pages/pagination-of-results.adoc @@ -160,33 +160,33 @@ include::example$PaginationRefGuideExamplesTest.java[tag=cursormark-query] If you wanted to do this by hand using curl, the sequence of requests would look something like this: -[source,plain] +[source,console] ---- -curl '...&rows=10&sort=id+asc&cursorMark=*' +$ curl '...&rows=10&sort=id+asc&cursorMark=*' { "response":{"numFound":32,"start":0,"docs":[ // ... 10 docs here ... ]}, "nextCursorMark":"AoEjR0JQ"} -curl '...&rows=10&sort=id+asc&cursorMark=AoEjR0JQ' +$ curl '...&rows=10&sort=id+asc&cursorMark=AoEjR0JQ' { "response":{"numFound":32,"start":0,"docs":[ // ... 10 more docs here ... ]}, "nextCursorMark":"AoEpVkRCREIxQTE2"} -curl '...&rows=10&sort=id+asc&cursorMark=AoEpVkRCREIxQTE2' +$ curl '...&rows=10&sort=id+asc&cursorMark=AoEpVkRCREIxQTE2' { "response":{"numFound":32,"start":0,"docs":[ // ... 10 more docs here ... ]}, "nextCursorMark":"AoEmbWF4dG9y"} -curl '...&rows=10&sort=id+asc&cursorMark=AoEmbWF4dG9y' +$ curl '...&rows=10&sort=id+asc&cursorMark=AoEmbWF4dG9y' { "response":{"numFound":32,"start":0,"docs":[ // ... 2 docs here because we've reached the end. ]}, "nextCursorMark":"AoEpdmlld3Nvbmlj"} -curl '...&rows=10&sort=id+asc&cursorMark=AoEpdmlld3Nvbmlj' +$ curl '...&rows=10&sort=id+asc&cursorMark=AoEpdmlld3Nvbmlj' { "response":{"numFound":32,"start":0,"docs":[ // no more docs here, and note that the nextCursorMark diff --git a/solr/solr-ref-guide/modules/query-guide/pages/searching-nested-documents.adoc b/solr/solr-ref-guide/modules/query-guide/pages/searching-nested-documents.adoc index 8cd15cbfafd5..a64b5d80ba38 100644 --- a/solr/solr-ref-guide/modules/query-guide/pages/searching-nested-documents.adoc +++ b/solr/solr-ref-guide/modules/query-guide/pages/searching-nested-documents.adoc @@ -41,9 +41,9 @@ For a detailed explanation of this transformer, and specifics on its syntax & li A simple query matching all documents with a description that includes "staplers": -[source,text] +[source,console] ---- -curl 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=description_t:staplers' +$ curl 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=description_t:staplers' { "response":{"numFound":1,"start":0,"maxScore":0.30136836,"numFoundExact":true,"docs":[ { @@ -57,9 +57,9 @@ curl 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=descrip The same query with the addition of the `[child]` transformer is shown below. Note that the `numFound` has not changed, we are still matching the same set of documents, but when returning those documents the nested children are also returned as pseudo-fields. -[source,text] +[source,console] ---- -curl 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=description_t:staplers&fl=*,[child]' +$ curl 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=description_t:staplers&fl=*,[child]' { "response":{"numFound":1,"start":0,"maxScore":0.30136836,"numFoundExact":true,"docs":[ { @@ -110,9 +110,9 @@ For a detailed explanation of this parser, see the section xref:block-join-query Let's consider again the `description_t:staplers` query used above -- if we wrap that query in a `{!child}` query parser with `parentPath="/"` then instead of "matching" & returning the product level documents, we instead match all of the _descendent_ child documents of the original query: -[source,text] +[source,console] ---- -curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' --data-urlencode 'q={!child parentPath="/"}description_t:staplers' +$ curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' --data-urlencode 'q={!child parentPath="/"}description_t:staplers' { "response":{"numFound":5,"start":0,"maxScore":0.30136836,"numFoundExact":true,"docs":[ { @@ -151,9 +151,9 @@ In this example `parentPath="/"` indicates we want to consider all root-level do By changing the `parentPath` to a specific `_nest_path_` level, we can narrow down the list of children we return. In the query below, we search for all children of `skus` with a `price_i` less than `50`: -[source,text] +[source,console] ---- -curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' --data-urlencode 'q={!child parentPath="/skus"}price_i:[* TO 50]' +$ curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' --data-urlencode 'q={!child parentPath="/skus"}price_i:[* TO 50]' { "response":{"numFound":1,"start":0,"maxScore":1.0,"numFoundExact":true,"docs":[ { @@ -172,9 +172,9 @@ For a detailed explanation of this parser, see the section xref:block-join-query Let's first consider this example of searching for all "manual" type documents that have exactly `1` page: -[source,text] +[source,console] ---- -curl 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=pages_i:1' +$ curl 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=pages_i:1' { "response":{"numFound":3,"start":0,"maxScore":1.0,"numFoundExact":true,"docs":[ { @@ -200,9 +200,9 @@ curl 'http://localhost:8983/solr/gettingstarted/select?omitHeader=true&q=pages_i We can wrap that query in a `{!parent}` query with `parentPath="/"` to return the details of all root-level products that are ancestors of these manuals: -[source,text] +[source,console] ---- -curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' --data-urlencode 'q={!parent parentPath="/"}pages_i:1' +$ curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' --data-urlencode 'q={!parent parentPath="/"}pages_i:1' { "response":{"numFound":2,"start":0,"maxScore":1.4E-45,"numFoundExact":true,"docs":[ { @@ -224,9 +224,9 @@ By changing `parentPath` to a specific path, we can change the type of ancestors In the query below, we search for the `skus` that are the ancestors of `manuals` with exactly `1` page. Adding `childPath="manuals"` constrains the child query to only docs nested at `/skus/manuals`, preventing pages from other child types from matching: -[source,text] +[source,console] ---- -curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' --data-urlencode 'q={!parent parentPath="/skus" childPath="manuals"}pages_i:1' +$ curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' --data-urlencode 'q={!parent parentPath="/skus" childPath="manuals"}pages_i:1' { "response":{"numFound":2,"start":0,"maxScore":1.4E-45,"numFoundExact":true,"docs":[ { @@ -254,9 +254,9 @@ Here for example is a query where: *** "lifetime guarantee" in their content * each return (sku) document also includes any descendent (manuals) documents it has -[source,text] +[source,console] ---- -curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' -d 'fq=color_s:RED' --data-urlencode 'q={!child parentPath="/" filters=$parent_fq}' --data-urlencode 'parent_fq={!parent parentPath="/"}content_t:"lifetime guarantee"' -d 'fl=*,[child]' +$ curl 'http://localhost:8983/solr/gettingstarted/select' -d 'omitHeader=true' -d 'fq=color_s:RED' --data-urlencode 'q={!child parentPath="/" filters=$parent_fq}' --data-urlencode 'parent_fq={!parent parentPath="/"}content_t:"lifetime guarantee"' -d 'fl=*,[child]' { "response":{"numFound":1,"start":0,"maxScore":1.4E-45,"numFoundExact":true,"docs":[ { diff --git a/solr/solr-ref-guide/modules/query-guide/pages/spatial-search.adoc b/solr/solr-ref-guide/modules/query-guide/pages/spatial-search.adoc index da5afbcaec30..8c180681806d 100644 --- a/solr/solr-ref-guide/modules/query-guide/pages/spatial-search.adoc +++ b/solr/solr-ref-guide/modules/query-guide/pages/spatial-search.adoc @@ -70,9 +70,9 @@ However, it's much bulkier than the raw coordinates for such simple data. Using the `bin/solr post` tool: -[,console] +[,bash] ---- -$ bin/solr post -t "application/json" --solr-url http://localhost:8983 --name mycollection --params "format=geojson" /path/to/geojson.file +bin/solr post -t "application/json" --solr-url http://localhost:8983 --name mycollection --params "format=geojson" /path/to/geojson.file ---- The key parameter to pass in with your request is: diff --git a/solr/solr-ref-guide/modules/query-guide/pages/stream-command.adoc b/solr/solr-ref-guide/modules/query-guide/pages/stream-command.adoc index 64b2b369dcdd..8cba038e7827 100644 --- a/solr/solr-ref-guide/modules/query-guide/pages/stream-command.adoc +++ b/solr/solr-ref-guide/modules/query-guide/pages/stream-command.adoc @@ -26,14 +26,14 @@ It may change in backwards-incompatible ways as it evolves to cover additional f To run it, open a terminal and enter: -[,console] +[,bash] ---- -$ bin/solr stream -c techproducts --header --fields price,name --delimiter=\| 'search(techproducts,q="iPod",fl="name,price")' +bin/solr stream -c techproducts --header --fields price,name --delimiter=\| 'search(techproducts,q="iPod",fl="name,price")' ---- This will run the provided streaming expression on the `techproducts` collection on your local Solr and produce: -[,console] +[,text] ---- price|name 11.5|iPod & iPod Mini USB 2.0 Cable @@ -70,14 +70,14 @@ Notice the various ways to format comments in the file? Then you can run it on the Solr collection `techproducts`, specifying you want a header row: -[,console] +[,bash] ---- -$ bin/solr stream --header -c techproducts stream.expr +bin/solr stream --header -c techproducts stream.expr ---- And this will produce: -[,console] +[,text] ---- name price CORSAIR XMS 2GB (2 x 1GB) 184-Pin DDR SDRAM Unbuffered DDR 400 (PC 3200) Dual Channel Kit System Memory - Retail 185.0 @@ -151,9 +151,9 @@ Running this expression will read in the local file and send the first two lines TIP: Want to send data to a remote Solr? pass in `--solr-url http://solr.remote:8983`. -[,console] +[,bash] ---- -$ bin/solr stream --execution local --header load_data.expr +bin/solr stream --execution local --header load_data.expr ---- @@ -171,9 +171,9 @@ Caveats: Index a CSV file into `gettingstarted` collection. -[,console] +[,bash] ---- -$ cat example/exampledocs/books.csv | bin/solr stream -e local 'update(gettingstarted,parseCSV(stdin()))' +cat example/exampledocs/books.csv | bin/solr stream -e local 'update(gettingstarted,parseCSV(stdin()))' ---- === Variable interpolation @@ -200,7 +200,7 @@ update( ) ---- -[,console] +[,bash] ---- -$ bin/solr stream -c techproducts file.expr ./example/exampledocs/books.csv 10 +bin/solr stream -c techproducts file.expr ./example/exampledocs/books.csv 10 ---- diff --git a/solr/solr-ref-guide/modules/query-guide/pages/tagger-handler.adoc b/solr/solr-ref-guide/modules/query-guide/pages/tagger-handler.adoc index ba11e5ab27c0..17bf9e903bbc 100644 --- a/solr/solr-ref-guide/modules/query-guide/pages/tagger-handler.adoc +++ b/solr/solr-ref-guide/modules/query-guide/pages/tagger-handler.adoc @@ -275,16 +275,16 @@ should be almost 7MB file expanding to a cities1000.txt file around population. Using bin/solr post: -[,console] +[,bash] ---- -$ bin/solr post -c geonames -t text/csv \ +bin/solr post -c geonames -t text/csv \ --params 'optimize=true&maxSegments=1&separator=%09&encapsulator=%00&fieldnames=id,name,,alternative_names,latitude,longitude,,,countrycode,,,,,,population,elevation,,timezone,lastupdate' \ /tmp/cities1000.txt ---- or using curl: -[,console] +[,bash] ---- curl 'http://localhost:8983/solr/geonames/update?commit=true&optimize=true&maxSegments=1&separator=%09&encapsulator=%00&fieldnames=id,name,,alternative_names,latitude,longitude,,,countrycode,,,,,,population,elevation,,timezone,lastupdate' \ --data-binary @/path/to/cities1000.txt -H 'Content-type:application/csv' @@ -306,7 +306,7 @@ This is a trivial example tagging a small piece of text. For more options, see the earlier documentation. -[,console] +[,bash] ---- curl \ 'http://localhost:8983/solr/geonames/tag?overlaps=NO_SUB&tagsLimit=5000&fl=id,name,countrycode&wt=json&indent=on' \