This is an automated email from the ASF dual-hosted git repository. asf-gitbox-commits pushed a commit to branch branch_10_1 in repository https://gitbox.apache.org/repos/asf/solr.git
commit af5a637008a5ce5fc98546ba712712863e53aad6 Author: Serhiy Bzhezytskyy <[email protected]> AuthorDate: Thu Oct 1 23:09:37 2026 +0300 SOLR-18491: Show the v2 API next to v1 on four Ref Guide pages (#4993) (cherry picked from commit a343e01974a9a0e6f9d9b40768db02f8eedccbc6) (cherry picked from commit bad52ec89dbf876a9c34d65015c03397563fbd89) --- .../pages/jwt-authentication-plugin.adoc | 16 +++++ .../deployment-guide/pages/solr-in-docker.adoc | 18 +++++- .../indexing-guide/pages/schemaless-mode.adoc | 75 +++++++++++++++++++++- .../query-guide/pages/exporting-result-sets.adoc | 55 +++++++++++++++- 4 files changed, 157 insertions(+), 7 deletions(-) diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/jwt-authentication-plugin.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/jwt-authentication-plugin.adoc index 40b5d5b5be2..f07f912a0e5 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/jwt-authentication-plugin.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/jwt-authentication-plugin.adoc @@ -269,10 +269,26 @@ SolrJ does not currently support supplying JWT tokens per request. To authenticate with Solr when using the cURL utility, supply a valid JWT access token in an `Authorization` header, as follows (replace xxxxxx.xxxxxx.xxxxxx with your JWT compact token): +[tabs#jwt-curl-header] +====== +V1 API:: ++ +==== [source,bash] ---- curl -H "Authorization: Bearer xxxxxx.xxxxxx.xxxxxx" http://localhost:8983/solr/admin/info/system ---- +==== + +V2 API:: ++ +==== +[source,bash] +---- +curl -H "Authorization: Bearer xxxxxx.xxxxxx.xxxxxx" http://localhost:8983/api/node/system +---- +==== +====== === Admin UI diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc index 8012b18b0b0..d819053f401 100644 --- a/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc +++ b/solr/solr-ref-guide/modules/deployment-guide/pages/solr-in-docker.adoc @@ -162,10 +162,26 @@ docker run -e SOLR_HOST_ADVERTISE=solr1 --network docs_solr solr solr create -c The fourth way is to use the remote API, from the host or from one of the containers, or some new container on the same network (adjust the hostname accordingly): +[tabs#docker-create-collection] +====== +V1 API:: ++ +==== [source,bash] ---- -curl 'http://localhost:8983/solr/admin/collections?action=CREATE&name=gettingstarted3&numShards=1&collection.configName=_default' +curl 'http://localhost:8983/solr/admin/collections?action=CREATE&name=gettingstarted4&numShards=1&collection.configName=_default' ---- +==== + +V2 API:: ++ +==== +[source,bash] +---- +curl http://localhost:8983/api/collections -H 'Content-Type: application/json' -d '{"name": "gettingstarted4", "numShards": 1, "config": "_default"}' +---- +==== +====== If you want to use a custom configuration for your collection, you first need to upload it, and then refer to it by name when you create the collection. You can use the xref:solr-control-script-reference.adoc#upload-a-configuration-set[`bin/solr zk` command] or the xref:configuration-guide:configsets-api.adoc#configsets-upload[Configsets API]. diff --git a/solr/solr-ref-guide/modules/indexing-guide/pages/schemaless-mode.adoc b/solr/solr-ref-guide/modules/indexing-guide/pages/schemaless-mode.adoc index a79dc8ca082..1a29a9722ab 100644 --- a/solr/solr-ref-guide/modules/indexing-guide/pages/schemaless-mode.adoc +++ b/solr/solr-ref-guide/modules/indexing-guide/pages/schemaless-mode.adoc @@ -37,7 +37,30 @@ bin/solr start -e schemaless This will launch a single Solr server, and automatically create a collection (named "```gettingstarted```") that contains only three fields in the initial schema: `id`, `\_version_`, and `\_text_`. -You can use the `/schema/fields` xref:schema-api.adoc[] to confirm this: `curl \http://localhost:8983/solr/gettingstarted/schema/fields` will output: +You can use the `/schema/fields` xref:schema-api.adoc[] to confirm this: + +[tabs#schemaless-fields-initial] +====== +V1 API:: ++ +==== +[source,bash] +---- +curl http://localhost:8983/solr/gettingstarted/schema/fields +---- +==== + +V2 API:: ++ +==== +[source,bash] +---- +curl http://localhost:8983/api/collections/gettingstarted/schema/fields +---- +==== +====== + +The output will be: [source,json] ---- @@ -246,7 +269,30 @@ Output indicating success: </response> ---- -The fields now in the schema (output from `curl \http://localhost:8983/solr/gettingstarted/schema/fields` ): +To see the fields now in the schema: + +[tabs#schemaless-fields-after] +====== +V1 API:: ++ +==== +[source,bash] +---- +curl http://localhost:8983/solr/gettingstarted/schema/fields +---- +==== + +V2 API:: ++ +==== +[source,bash] +---- +curl http://localhost:8983/api/collections/gettingstarted/schema/fields +---- +==== +====== + +The output is: [source,json] ---- @@ -283,7 +329,30 @@ The fields now in the schema (output from `curl \http://localhost:8983/solr/gett ]} ---- -In addition string versions of the text fields are indexed, using copyFields to a `*_str` dynamic field: (output from `curl \http://localhost:8983/solr/gettingstarted/schema/copyfields` ): +In addition string versions of the text fields are indexed, using copyFields to a `*_str` dynamic field. To see them: + +[tabs#schemaless-copyfields] +====== +V1 API:: ++ +==== +[source,bash] +---- +curl http://localhost:8983/solr/gettingstarted/schema/copyfields +---- +==== + +V2 API:: ++ +==== +[source,bash] +---- +curl http://localhost:8983/api/collections/gettingstarted/schema/copyfields +---- +==== +====== + +The output is: [source,json] ---- diff --git a/solr/solr-ref-guide/modules/query-guide/pages/exporting-result-sets.adoc b/solr/solr-ref-guide/modules/query-guide/pages/exporting-result-sets.adoc index fc6f4d6a7ef..d870f56f961 100644 --- a/solr/solr-ref-guide/modules/query-guide/pages/exporting-result-sets.adoc +++ b/solr/solr-ref-guide/modules/query-guide/pages/exporting-result-sets.adoc @@ -58,10 +58,26 @@ The default output format is `json`. Here is an example of an export request of some indexed log data: +[tabs#export-basic] +====== +V1 API:: ++ +==== [source,text] ---- -http://localhost:8983/solr/core_name/export?q=my-query&sort=severity+desc,timestamp+desc&fl=severity,timestamp,msg +http://localhost:8983/solr/collection_name/export?q=my-query&sort=severity+desc,timestamp+desc&fl=severity,timestamp,msg ---- +==== + +V2 API:: ++ +==== +[source,text] +---- +http://localhost:8983/api/collections/collection_name/export?q=my-query&sort=severity+desc,timestamp+desc&fl=severity,timestamp,msg +---- +==== +====== === Specifying the Sort Criteria @@ -100,20 +116,53 @@ Only stream xref:stream-decorator-reference.adoc[decorators] and xref:stream-eva Using stream expressions with the `/export` handler may result in dramatic performance improvements due to the local in-memory reduction of the number of documents to be returned. Here's an example of using `top` decorator for returning only top N results: + +[tabs#export-top] +====== +V1 API:: ++ +==== [source,text] ---- -http://localhost:8983/solr/core_name/export?q=my-query&sort=timestamp+desc,&fl=timestamp,reporter,severity&expr=top(n=2,input(),sort="timestamp+desc") +http://localhost:8983/solr/collection_name/export?q=my-query&sort=timestamp+desc,&fl=timestamp,reporter,severity&expr=top(n=2,input(),sort="timestamp+desc") ---- +==== + +V2 API:: ++ +==== +[source,text] +---- +http://localhost:8983/api/collections/collection_name/export?q=my-query&sort=timestamp+desc,&fl=timestamp,reporter,severity&expr=top(n=2,input(),sort="timestamp+desc") +---- +==== +====== (Note that the sort spec in the `top` decorator must match the sort spec in the handler parameter). Here's an example of using `unique` decorator: +[tabs#export-unique] +====== +V1 API:: ++ +==== +[source,text] +---- +http://localhost:8983/solr/collection_name/export?q=my-query&sort=reporter+desc,&fl=reporter&expr=unique(input(),over="reporter") +---- +==== + +V2 API:: ++ +==== [source,text] ---- -http://localhost:8983/solr/core_name/export?q=my-query&sort=reporter+desc,&fl=reporter&expr=unique(input(),over="reporter") +http://localhost:8983/api/collections/collection_name/export?q=my-query&sort=reporter+desc,&fl=reporter&expr=unique(input(),over="reporter") ---- +==== +====== (Note that the `over` parameter must use one of the fields requested in the `fl` parameter).
