You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2024/10/17 17:31:08 UTC
(solr) 01/02: SOLR-17489: CLI: Deprecate variations on solr urls options (#2756)
This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
commit ce4edd2c1040f42a8a55d416f5f63de4d9c56a42
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Thu Oct 17 08:03:09 2024 -0400
SOLR-17489: CLI: Deprecate variations on solr urls options (#2756)
Use --solr-url and --name consistently.
(cherry picked from commit 0f4a46527c174d81c14c9022163c99f2bbaefe59)
---
.../src/java/org/apache/solr/cli/ExportTool.java | 32 ++++++-
.../src/java/org/apache/solr/cli/PostLogsTool.java | 32 ++++++-
.../src/java/org/apache/solr/cli/PostTool.java | 24 ++++--
.../java/org/apache/solr/cli/RunExampleTool.java | 14 ++--
.../src/test/org/apache/solr/cli/PostToolTest.java | 6 +-
.../apache/solr/cloud/SolrCloudExampleTest.java | 6 +-
solr/packaging/test/test_export.bats | 2 +-
solr/packaging/test/test_extraction.bats | 4 +-
solr/packaging/test/test_post.bats | 11 +++
solr/packaging/test/test_snapshots.bats | 2 +-
solr/packaging/test/test_ssl.bats | 2 +-
.../solr/prometheus/exporter/SolrExporter.java | 3 +-
.../deployment-guide/pages/enabling-ssl.adoc | 2 +-
.../modules/indexing-guide/pages/post-tool.adoc | 98 ++++++++--------------
.../modules/query-guide/pages/spatial-search.adoc | 2 +-
15 files changed, 147 insertions(+), 93 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/cli/ExportTool.java b/solr/core/src/java/org/apache/solr/cli/ExportTool.java
index 09ea1fc2ca9..48fa226030b 100644
--- a/solr/core/src/java/org/apache/solr/cli/ExportTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/ExportTool.java
@@ -54,6 +54,7 @@ import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.zip.GZIPOutputStream;
import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DeprecatedAttributes;
import org.apache.commons.cli.Option;
import org.apache.lucene.util.SuppressForbidden;
import org.apache.solr.client.solrj.SolrClient;
@@ -97,11 +98,22 @@ public class ExportTool extends ToolBase {
return List.of(
Option.builder("url")
.longOpt("solr-collection-url")
+ .deprecated(
+ DeprecatedAttributes.builder()
+ .setForRemoval(true)
+ .setSince("9.8")
+ .setDescription("Use --solr-url and -c / --name instead")
+ .get())
.hasArg()
.argName("URL")
- .required()
.desc("Address of the collection, example http://localhost:8983/solr/gettingstarted.")
.build(),
+ Option.builder("c")
+ .longOpt("name")
+ .hasArg()
+ .argName("NAME")
+ .desc("Name of the collection.")
+ .build(),
Option.builder("out")
.hasArg()
.argName("PATH")
@@ -128,7 +140,8 @@ public class ExportTool extends ToolBase {
.hasArg()
.argName("FIELDA,FIELDB")
.desc("Comma separated list of fields to export. By default all fields are fetched.")
- .build());
+ .build(),
+ SolrCLI.OPTION_SOLRURL);
}
public abstract static class Info {
@@ -236,7 +249,20 @@ public class ExportTool extends ToolBase {
@Override
public void runImpl(CommandLine cli) throws Exception {
- String url = cli.getOptionValue("solr-collection-url");
+ String url = null;
+ if (cli.hasOption("solr-url")) {
+ if (!cli.hasOption("name")) {
+ throw new IllegalArgumentException(
+ "Must specify -c / --name parameter with --solr-url to post documents.");
+ }
+ url = SolrCLI.normalizeSolrUrl(cli) + "/solr/" + cli.getOptionValue("name");
+
+ } else if (cli.hasOption("solr-collection-url")) {
+ url = cli.getOptionValue("solr-collection-url");
+ } else {
+ // Swap to required Option when --solr-collection-url removed.
+ throw new IllegalArgumentException("Must specify --solr-url.");
+ }
Info info = new MultiThreadedRunner(url);
info.query = cli.getOptionValue("query", "*:*");
info.setOutFormat(
diff --git a/solr/core/src/java/org/apache/solr/cli/PostLogsTool.java b/solr/core/src/java/org/apache/solr/cli/PostLogsTool.java
index bfdbe9b0ffc..9d28c755239 100644
--- a/solr/core/src/java/org/apache/solr/cli/PostLogsTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/PostLogsTool.java
@@ -36,6 +36,7 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.DeprecatedAttributes;
import org.apache.commons.cli.Option;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
@@ -65,23 +66,48 @@ public class PostLogsTool extends ToolBase {
return List.of(
Option.builder("url")
.longOpt("solr-collection-url")
+ .deprecated(
+ DeprecatedAttributes.builder()
+ .setForRemoval(true)
+ .setSince("9.8")
+ .setDescription("Use --solr-url and -c / --name instead")
+ .get())
.hasArg()
.argName("ADDRESS")
- .required(true)
.desc("Address of the collection, example http://localhost:8983/solr/collection1/.")
.build(),
+ Option.builder("c")
+ .longOpt("name")
+ .hasArg()
+ .argName("NAME")
+ .desc("Name of the collection.")
+ .build(),
Option.builder("rootdir")
.longOpt("rootdir")
.hasArg()
.argName("DIRECTORY")
.required(true)
.desc("All files found at or below the root directory will be indexed.")
- .build());
+ .build(),
+ SolrCLI.OPTION_SOLRURL);
}
@Override
public void runImpl(CommandLine cli) throws Exception {
- String url = cli.getOptionValue("url");
+ String url = null;
+ if (cli.hasOption("solr-url")) {
+ if (!cli.hasOption("name")) {
+ throw new IllegalArgumentException(
+ "Must specify -c / --name parameter with --solr-url to post documents.");
+ }
+ url = SolrCLI.normalizeSolrUrl(cli) + "/solr/" + cli.getOptionValue("name");
+
+ } else if (cli.hasOption("solr-collection-url")) {
+ url = cli.getOptionValue("solr-collection-url");
+ } else {
+ // Swap to required Option when --solr-collection-url removed.
+ throw new IllegalArgumentException("Must specify --solr-url.");
+ }
String rootDir = cli.getOptionValue("rootdir");
runCommand(url, rootDir);
}
diff --git a/solr/core/src/java/org/apache/solr/cli/PostTool.java b/solr/core/src/java/org/apache/solr/cli/PostTool.java
index dd16610d686..f8ee89d3102 100644
--- a/solr/core/src/java/org/apache/solr/cli/PostTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/PostTool.java
@@ -172,6 +172,12 @@ public class PostTool extends ToolBase {
return List.of(
Option.builder("url")
.longOpt("solr-update-url")
+ .deprecated(
+ DeprecatedAttributes.builder()
+ .setForRemoval(true)
+ .setSince("9.8")
+ .setDescription("Use --solr-url and -c / --name instead")
+ .get())
.hasArg()
.argName("UPDATEURL")
.desc("Solr Update URL, the full url to the update handler, including the /update.")
@@ -180,12 +186,10 @@ public class PostTool extends ToolBase {
.longOpt("name")
.hasArg()
.argName("NAME")
- .required(false)
.desc("Name of the collection.")
.build(),
Option.builder()
.longOpt("skip-commit")
- .required(false)
.desc("Do not 'commit', and thus changes won't be visible till a commit occurs.")
.build(),
Option.builder()
@@ -196,19 +200,16 @@ public class PostTool extends ToolBase {
.setSince("9.7")
.setDescription("Use --skip-commit instead")
.get())
- .required(false)
.desc("Do not 'commit', and thus changes won't be visible till a commit occurs.")
.build(),
Option.builder("o")
.longOpt("optimize")
- .required(false)
.desc("Issue an optimize at end of posting documents.")
.build(),
Option.builder()
.longOpt("mode")
.hasArg()
.argName("mode")
- .required(false)
.desc(
"Which mode the Post tool is running in, 'files' crawls local directory, 'web' crawls website, 'args' processes input args, and 'stdin' reads a command from standard in. default: files.")
.build(),
@@ -300,7 +301,8 @@ public class PostTool extends ToolBase {
.required(false)
.desc(
"Performs a dry run of the posting process without actually sending documents to Solr. Only works with files mode.")
- .build());
+ .build(),
+ SolrCLI.OPTION_SOLRURL);
}
@Override
@@ -308,8 +310,16 @@ public class PostTool extends ToolBase {
SolrCLI.raiseLogLevelUnlessVerbose(cli);
solrUpdateUrl = null;
+ if (cli.hasOption("solr-url")) {
+ if (!cli.hasOption("name")) {
+ throw new IllegalArgumentException(
+ "Must specify -c / --name parameter with --solr-url to post documents.");
+ }
+ String url =
+ SolrCLI.normalizeSolrUrl(cli) + "/" + cli.getOptionValue("name") + "/update";
+ solrUpdateUrl = new URI(url);
- if (cli.hasOption("solr-update-url")) {
+ } else if (cli.hasOption("solr-update-url")) {
String url = cli.getOptionValue("solr-update-url");
solrUpdateUrl = new URI(url);
} else if (cli.hasOption("name")) {
diff --git a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
index b1a8ac82033..eafd0d9c280 100644
--- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
+++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java
@@ -328,14 +328,15 @@ public class RunExampleTool extends ToolBase {
}
if (exampledocsDir.isDirectory()) {
- String updateUrl = String.format(Locale.ROOT, "%s/%s/update", solrUrl, collectionName);
echo("Indexing tech product example docs from " + exampledocsDir.getAbsolutePath());
String[] args =
new String[] {
"post",
- "--solr-update-url",
- updateUrl,
+ "--solr-url",
+ solrUrl,
+ "--name",
+ collectionName,
"--type",
"application/xml",
exampledocsDir.getAbsolutePath() + "/*.xml"
@@ -410,13 +411,14 @@ public class RunExampleTool extends ToolBase {
+ " }\n");
File filmsJsonFile = new File(exampleDir, "films/films.json");
- String updateUrl = String.format(Locale.ROOT, "%s/%s/update/json", solrUrl, collectionName);
echo("Indexing films example docs from " + filmsJsonFile.getAbsolutePath());
String[] args =
new String[] {
"post",
- "--solr-update-url",
- updateUrl,
+ "--solr-url",
+ solrUrl,
+ "--name",
+ collectionName,
"--type",
"application/json",
filmsJsonFile.getAbsolutePath()
diff --git a/solr/core/src/test/org/apache/solr/cli/PostToolTest.java b/solr/core/src/test/org/apache/solr/cli/PostToolTest.java
index 89f61115dda..7488988c7d9 100644
--- a/solr/core/src/test/org/apache/solr/cli/PostToolTest.java
+++ b/solr/core/src/test/org/apache/solr/cli/PostToolTest.java
@@ -74,8 +74,10 @@ public class PostToolTest extends SolrCloudTestCase {
String[] args = {
"post",
- "--solr-update-url",
- cluster.getJettySolrRunner(0).getBaseUrl() + "/" + collection + "/update",
+ "--solr-url",
+ cluster.getJettySolrRunner(0).getBaseUrl().toString(),
+ "--name",
+ collection,
jsonDoc.getAbsolutePath()
};
assertEquals(0, runTool(args));
diff --git a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java
index 106ec16f1dc..1386737a712 100644
--- a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java
@@ -115,8 +115,10 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {
String[] argsForPost =
new String[] {
- "--solr-update-url",
- solrUrl + "/" + testCollectionName + "/update",
+ "--solr-url",
+ solrUrl,
+ "--name",
+ testCollectionName,
"--filetypes",
"xml",
exampleDocsDir.toAbsolutePath().toString()
diff --git a/solr/packaging/test/test_export.bats b/solr/packaging/test/test_export.bats
index 01e4810bf22..77e08c66833 100644
--- a/solr/packaging/test/test_export.bats
+++ b/solr/packaging/test/test_export.bats
@@ -30,7 +30,7 @@ teardown() {
@test "Check export command" {
run solr start -c -e techproducts
- run solr export --solr-collection-url "http://localhost:${SOLR_PORT}/solr/techproducts" -query "*:* -id:test" -out "${BATS_TEST_TMPDIR}/output"
+ run solr export --solr-url http://localhost:${SOLR_PORT} --name techproducts -query "*:* -id:test" -out "${BATS_TEST_TMPDIR}/output"
refute_output --partial 'Unrecognized option'
assert_output --partial 'Export complete'
diff --git a/solr/packaging/test/test_extraction.bats b/solr/packaging/test/test_extraction.bats
index ef7dfa29714..987443f0535 100644
--- a/solr/packaging/test/test_extraction.bats
+++ b/solr/packaging/test/test_extraction.bats
@@ -73,7 +73,7 @@ teardown() {
}' "http://localhost:${SOLR_PORT}/solr/content_extraction/config"
# We filter to pdf to invoke the Extract handler.
- run solr post --filetypes pdf -url http://localhost:${SOLR_PORT}/solr/content_extraction/update ${SOLR_TIP}/example/exampledocs
+ run solr post --filetypes pdf --solr-url http://localhost:${SOLR_PORT} --name content_extraction ${SOLR_TIP}/example/exampledocs
assert_output --partial '1 files indexed.'
refute_output --partial 'ERROR'
@@ -100,7 +100,7 @@ teardown() {
}' "http://localhost:${SOLR_PORT}/solr/website_extraction/config"
# Change to --recursive 1 to crawl multiple pages, but may be too slow.
- run solr post --mode web --solr-update-url http://localhost:${SOLR_PORT}/solr/website_extraction/update --recursive 0 --delay 1 https://solr.apache.org/
+ run solr post --mode web --solr-url http://localhost:${SOLR_PORT} -c website_extraction --recursive 0 --delay 1 https://solr.apache.org/
assert_output --partial 'POSTed web resource https://solr.apache.org (depth: 0)'
refute_output --partial 'ERROR'
diff --git a/solr/packaging/test/test_post.bats b/solr/packaging/test/test_post.bats
index 38652a8c5da..bd78feb9d81 100644
--- a/solr/packaging/test/test_post.bats
+++ b/solr/packaging/test/test_post.bats
@@ -74,6 +74,17 @@ teardown() {
refute_output --partial 'ERROR'
}
+@test "basic post with solr-url and collection" {
+
+ run solr create -c monitors_solr_url_param -d _default
+ assert_output --partial "Created collection 'monitors_solr_url_param'"
+
+ run solr post --type application/xml -c monitors_solr_url_param --solr-url http://localhost:${SOLR_PORT} ${SOLR_TIP}/example/exampledocs/monitor.xml
+
+ assert_output --partial '1 files indexed.'
+ refute_output --partial 'ERROR'
+}
+
@test "basic post WITHOUT a type specified" {
solr create -c monitors_no_type -d _default
diff --git a/solr/packaging/test/test_snapshots.bats b/solr/packaging/test/test_snapshots.bats
index 4a6135bbd01..ebd3d90a197 100644
--- a/solr/packaging/test/test_snapshots.bats
+++ b/solr/packaging/test/test_snapshots.bats
@@ -45,7 +45,7 @@ teardown() {
run solr snapshot-create -c films --snapshot-name snapshot1 --solr-url http://localhost:${SOLR_PORT}
assert_output --partial "Successfully created snapshot with name snapshot1 for collection films"
- run solr snapshot-delete -c films --snapshot-name snapshot1 -url http://localhost:${SOLR_PORT}
+ run solr snapshot-delete -c films --snapshot-name snapshot1 --solr-url http://localhost:${SOLR_PORT}
assert_output --partial "Successfully deleted snapshot with name snapshot1 for collection films"
# make sure you can create it again!
diff --git a/solr/packaging/test/test_ssl.bats b/solr/packaging/test/test_ssl.bats
index f8b49ada0bd..82057d06407 100644
--- a/solr/packaging/test/test_ssl.bats
+++ b/solr/packaging/test/test_ssl.bats
@@ -606,7 +606,7 @@ teardown() {
run solr api -get "https://localhost:${SOLR2_PORT}/solr/test-single-shard/select?q=query4"
assert_output --partial '"numFound":0'
- run solr post --solr-update-url https://localhost:${SOLR_PORT}/solr/test/update ${SOLR_TIP}/example/exampledocs/books.csv
+ run solr post --solr-url https://localhost:${SOLR_PORT} -c test ${SOLR_TIP}/example/exampledocs/books.csv
run solr api -get "https://localhost:${SOLR_PORT}/solr/test/select?q=*:*"
assert_output --partial '"numFound":10'
diff --git a/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java b/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java
index a6924cded36..4c40b08e849 100644
--- a/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java
+++ b/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/exporter/SolrExporter.java
@@ -145,7 +145,7 @@ public class SolrExporter {
Options mainOptions = new Options();
Options deprecatedOptions = new Options();
- // Change to -s and --solr-url in main once -s for --scrape-interval removed.
+ // Change to -s and --solr-url in main once deprecated -s flag for --scrape-interval is removed.
Option baseUrlOption =
Option.builder("b")
.longOpt("base-url")
@@ -338,6 +338,7 @@ public class SolrExporter {
defaultClusterId = makeShortHash(zkHost);
scrapeConfiguration = SolrScrapeConfiguration.solrCloud(zkHost);
} else if (commandLine.hasOption(baseUrlOption) || commandLine.hasOption(baseUrlDepOption)) {
+ log.warn("-b and --base-url will be replaced with -s and --solr-url in Solr 10");
String baseUrl =
commandLine.hasOption(baseUrlOption)
? commandLine.getOptionValue(baseUrlOption)
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 234863ddc15..cbfc9d3f85c 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
@@ -437,7 +437,7 @@ Use `bin/solr post` to index some example documents to the SolrCloud collection
[source,console]
----
-$ bin/solr post --solr-update-url https://localhost:8984/solr/mycollection/update example/exampledocs/*.xml
+$ bin/solr post --solr-url https://localhost:8984 --name mycollection example/exampledocs/*.xml
----
=== Query Using curl
diff --git a/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adoc b/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adoc
index b208c4a85d0..0561c9b2c41 100644
--- a/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adoc
+++ b/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adoc
@@ -27,7 +27,7 @@ To run it, open a window and enter:
[,console]
----
-$ bin/solr post -url http://localhost:8983/gettingstarted/update 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`.
@@ -44,63 +44,37 @@ The basic usage of `bin/solr post` is:
[source,plain]
----
-usage: post
+usage: bin/solr post [-c <NAME>] [-d <delay>] [--dry-run] [--format] [-ft <<type>[,<type>,...]>] [-h] [--mode <mode>]
+ [-o] [--out] [--params <<key>=<value>[&<key>=<value>...]>] [-r <recursive>] [-s <HOST>] [--skip-commit] [-t
+ <content-type>] [-u <credentials>] [--verbose]
+
+List of options:
-c,--name <NAME> Name of the collection.
- --delay <delay> If recursive then delay
- will be the wait time
- between posts. default:
+ --delay <delay> If recursive then delay will be the wait time between posts. default:
10 for web, 0 for files
- --dry-run Performs a dry run of
- the posting process
- without actually sending
- documents to Solr. Only
- works with files mode.
- --format sends application/json
- content as Solr commands
- to /update instead of
+ --dry-run Performs a dry run of the posting process without actually sending
+ documents to Solr. Only works with files mode.
+ --format sends application/json content as Solr commands to /update instead of
/update/json/docs.
-ft,--filetypes <<type>[,<type>,...]> default:
- xml,json,jsonl,csv,pdf,d
- oc,docx,ppt,pptx,xls,xls
- x,odt,odp,ods,ott,otp,ot
- s,rtf,htm,html,txt,log
+ xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,
+ ots,rtf,htm,html,txt,log
-h,--help Print this message.
- --mode <mode> Which mode the Post tool
- is running in, 'files'
- crawls local directory,
- 'web' crawls website,
- 'args' processes input
- args, and 'stdin' reads
- a command from standard
- in. default: files.
- -o,--optimize Issue an optimize at end
- of posting documents.
- --out sends Solr response
- outputs to console.
- --params <<key>=<value>[&<key>=<value>...]> values must be
- URL-encoded; these pass
- through to Solr update
- request.
- -r,--recursive <recursive> For web crawl, how deep
- to go. default: 1
- --skip-commit Do not 'commit', and
- thus changes won't be
- visible till a commit
+ --mode <mode> Which mode the Post tool is running in, 'files' crawls local
+ directory, 'web' crawls website, 'args' processes input args, and
+ 'stdin' reads a command from standard in. default: files.
+ -o,--optimize Issue an optimize at end of posting documents.
+ --out sends Solr response outputs to console.
+ --params <<key>=<value>[&<key>=<value>...]> Values must be URL-encoded; these pass through to Solr update request.
+ -r,--recursive <recursive> For web crawl, how deep to go. default: 1
+ -s,--solr-url <HOST> Base Solr URL, which can be used to determine the zk-host if that's
+ not known; defaults to: http://localhost:8983.
+ --skip-commit Do not 'commit', and thus changes won't be visible till a commit
occurs.
- -t,--type <content-type> Specify a specific
- mimetype to use, such as
- application/json.
- -u,--credentials <credentials> Credentials in the
- format
- username:password.
- Example: --credentials
+ -t,--type <content-type> Specify a specific mimetype to use, such as application/json.
+ -u,--credentials <credentials> Credentials in the format username:password. Example: --credentials
solr:SolrRocks
- -url,--solr-update-url <UPDATEURL> Solr Update URL, the
- full url to the update
- handler, including the
- /update.
- -v,--verbose Enable more verbose
- command output.
+ --verbose Enable verbose command output.
----
@@ -115,7 +89,7 @@ Index all JSON files into `gettingstarted`.
[,console]
----
-$ bin/solr post -url http://localhost:8983/solr/gettingstarted/update *.json
+$ bin/solr post --solr-url http://localhost:8983 --name gettingstarted *.json
----
=== Indexing XML
@@ -124,21 +98,21 @@ Add all documents with file extension `.xml` to the collection named `gettingsta
[,console]
----
-$ bin/solr post -url http://localhost:8983/solr/gettingstarted/update *.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]
----
-$ bin/solr post -url http://localhost:8984/solr/gettingstarted/update article*.xml
+$ bin/solr post --solr-url http://localhost:8984 --name gettingstarted article*.xml
----
Send XML arguments to delete a document from `gettingstarted`.
[,console]
----
-$ bin/solr post -url http://localhost:8983/solr/gettingstarted/update --mode args --type application/xml '<delete><id>42</id></delete>'
+$ bin/solr post --solr-url http://localhost:8983 --name gettingstarted --mode args --type application/xml '<delete><id>42</id></delete>'
----
=== Indexing CSV and JSON
@@ -154,7 +128,7 @@ Index a tab-separated file into `gettingstarted`:
[,console]
----
-$ bin/solr post -url http://localhost:8984/solr/signals/update --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.
@@ -166,21 +140,21 @@ Index a PDF file into `gettingstarted`.
[,console]
----
-$ bin/solr post -url http://localhost:8983/solr/gettingstarted/update 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]
----
-$ bin/solr post -url http://localhost:8983/solr/gettingstarted/update 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]
----
-$ bin/solr post -url http://localhost:8983/solr/gettingstarted/update --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)
@@ -189,7 +163,7 @@ Index a PDF as the user "solr" with password "SolrRocks":
[,console]
----
-$ bin/solr post -u solr:SolrRocks -url http://localhost:8983/solr/gettingstarted/update a.pdf
+$ bin/solr post -u solr:SolrRocks --solr-url http://localhost:8983 --name gettingstarted a.pdf
----
=== Crawling a Website to Index Documents
@@ -210,7 +184,7 @@ Notice the `-out` providing raw responses from Solr.
[,console]
----
-$ echo '{commit: {}}' | bin/solr post --mode stdin -url http://localhost:8983/solr/my_collection/update --out
+$ echo '{commit: {}}' | bin/solr post --mode stdin --solr-url http://localhost:8983 --name my_collection --out
----
=== Raw Data as Source for Indexing
@@ -219,5 +193,5 @@ Provide the raw document as a string for indexing.
[,console]
----
-$ bin/solr post -url http://localhost:8983/solr/signals/update -mode args --type text/csv -out $'id,value\n1,0.47'
+$ bin/solr post --solr-url http://localhost:8983 --name signals -mode args --type text/csv -out $'id,value\n1,0.47'
----
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 68fba64f500..3efa0bfaf85 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
@@ -71,7 +71,7 @@ However, it's much bulkier than the raw coordinates for such simple data.
Using the `bin/solr post` tool:
[,console]
-$ bin/solr post -t "application/json" -url "http://localhost:8983/solr/mycollection/update?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: