Apache Solr open-source search software
SOLR-17068: Resolve mish mash of bin/post and bin/solr post references in favour of bin/solr post. (#2227)
Eric Pugh6e431cfd5fb5
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 45dd5aad3ed..c9dc2c8e651 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -175,6 +175,10 @@ Improvements* SOLR-16397: The v2 endpoint to request the status of asynchronous CoreAdmin commands has been updated to be more REST-ful.Now available at `GET /api/node/commands/someRequestId` (Sanjay Dutt via Jason Gerlowski)+* SOLR-17068: bin/solr post CLI use of options is now aligned closely with bin/post CLI tool, and is consistently+ referenced throughout the Ref Guide and source code, and is used through out our tests. The bin/post tool+ remains and has been tested to work. (Eric Pugh)+Optimizations---------------------* SOLR-17084: LBSolrClient (used by CloudSolrClient) now returns the count of core tracked as not live AKA zombiesdiff --git a/solr/core/src/java/org/apache/solr/cli/PostTool.java b/solr/core/src/java/org/apache/solr/cli/PostTool.javaindex 4edc2a8f3b8..42ca28ad769 100644--- a/solr/core/src/java/org/apache/solr/cli/PostTool.java+++ b/solr/core/src/java/org/apache/solr/cli/PostTool.java@@ -45,9 +45,16 @@ public class PostTool extends ToolBase {Option.builder("url").argName("url").hasArg()- .required(true)+ .required(false).desc("<base Solr update URL>").build(),+ Option.builder("c")+ .longOpt("name")+ .argName("NAME")+ .hasArg()+ .required(false)+ .desc("Name of the collection.")+ .build(),Option.builder("commit").required(false).desc("Issue a commit at end of post").build(),Option.builder("optimize").required(false).desc("Issue an optimize at end of post").build(),Option.builder("mode")@@ -103,8 +110,17 @@ public class PostTool extends ToolBase {public void runImpl(CommandLine cli) throws Exception {SolrCLI.raiseLogLevelUnlessVerbose(cli);- String url = cli.getOptionValue("url");- URL solrUrl = new URL(url);+ URL solrUrl = null;+ if (cli.hasOption("url")) {+ String url = cli.getOptionValue("url");+ solrUrl = new URL(url);+ } else if (cli.hasOption("c")) {+ String url = SolrCLI.getDefaultSolrUrl() + "/solr/" + cli.getOptionValue("c") + "/update";+ solrUrl = new URL(url);+ } else {+ throw new IllegalArgumentException(+ "Must specify either -url or -c parameter to post documents.");+ }String mode = SimplePostTool.DEFAULT_DATA_MODE;if (cli.hasOption("mode")) {diff --git a/solr/core/src/java/org/apache/solr/cli/SimplePostTool.java b/solr/core/src/java/org/apache/solr/cli/SimplePostTool.javaindex 35842eb1c38..170eb20ff59 100644--- a/solr/core/src/java/org/apache/solr/cli/SimplePostTool.java+++ b/solr/core/src/java/org/apache/solr/cli/SimplePostTool.java@@ -1089,9 +1089,6 @@ public class SimplePostTool {if (!credentials.contains(":")) {throw new Exception("credentials '" + credentials + "' must be of format user:pass");}- // urlc.setRequestProperty(- // "Authorization",- // "Basic " + Base64.getEncoder().encodeToString(credentials.getBytes(UTF_8)));urlc.setRequestProperty("Authorization","Basic " + Base64.getEncoder().encodeToString(credentials.getBytes(UTF_8)));diff --git a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java b/solr/core/src/java/org/apache/solr/cli/SolrCLI.javaindex 787d8f689ce..23713833e9b 100755--- a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java+++ b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java@@ -499,7 +499,7 @@ public class SolrCLI implements CLIO {/*** Strips off the end of solrUrl any /solr when a legacy solrUrl like http://localhost:8983/solr- * is used, and warns those users. In the future we'll have url's with /api as well.+ * is used, and warns those users. In the future we'll have urls ending with /api as well.** @param solrUrl The user supplied url to Solr.* @return the solrUrl in the format that Solr expects to see internally.diff --git a/solr/core/src/test/org/apache/solr/cli/PostToolTest.java b/solr/core/src/test/org/apache/solr/cli/PostToolTest.javaindex c45bd7095f8..b13b6ec7264 100644--- a/solr/core/src/test/org/apache/solr/cli/PostToolTest.java+++ b/solr/core/src/test/org/apache/solr/cli/PostToolTest.java@@ -33,6 +33,7 @@ import org.apache.solr.client.solrj.SolrRequest;import org.apache.solr.client.solrj.SolrResponse;import org.apache.solr.client.solrj.request.CollectionAdminRequest;import org.apache.solr.cloud.SolrCloudTestCase;+import org.apache.solr.common.util.EnvUtils;import org.apache.solr.common.util.Utils;import org.apache.solr.security.BasicAuthPlugin;import org.apache.solr.security.RuleBasedAuthorizationPlugin;@@ -68,7 +69,7 @@ public class PostToolTest extends SolrCloudTestCase {singletonMap(USER, getSaltedHashedValue(PASS)))));configureCluster(2)- .addConfig("conf", configset("cloud-minimal"))+ .addConfig("conf1", configset("cloud-minimal")).withSecurityJson(SECURITY_JSON).configure();}@@ -80,12 +81,12 @@ public class PostToolTest extends SolrCloudTestCase {@Testpublic void testBasicRun() throws Exception {- final String collection = "aliasedCollection";+ final String collection = "testBasicRun";- withBasicAuth(CollectionAdminRequest.createCollection(collection, "config", 1, 1, 0, 0))+ withBasicAuth(CollectionAdminRequest.createCollection(collection, "conf1", 1, 1, 0, 0)).processAndWait(cluster.getSolrClient(), 10);- File jsonDoc = File.createTempFile("temp", "json");+ File jsonDoc = File.createTempFile("temp", ".json");FileWriter fw = new FileWriter(jsonDoc, StandardCharsets.UTF_8);Utils.writeJson(Utils.toJSONString(Map.of("id", "1", "title", "mytitle")), fw, true);@@ -93,7 +94,7 @@ public class PostToolTest extends SolrCloudTestCase {String[] args = {"post","-url",- cluster.getJettySolrRunner(0).getBaseUrl() + "/" + collection,+ cluster.getJettySolrRunner(0).getBaseUrl() + "/" + collection + "/update","-credentials",USER + ":" + PASS,jsonDoc.getAbsolutePath()@@ -101,6 +102,27 @@ public class PostToolTest extends SolrCloudTestCase {assertEquals(0, runTool(args));}+ @Test+ public void testRunWithCollectionParam() throws Exception {+ final String collection = "testRunWithCollectionParam";++ // Provide the port as an environment variable for the PostTool to look up.+ EnvUtils.setEnv("SOLR_PORT", cluster.getJettySolrRunner(0).getLocalPort() + "");++ withBasicAuth(CollectionAdminRequest.createCollection(collection, "conf1", 1, 1, 0, 0))+ .processAndWait(cluster.getSolrClient(), 10);++ File jsonDoc = File.createTempFile("temp", "json");++ FileWriter fw = new FileWriter(jsonDoc, StandardCharsets.UTF_8);+ Utils.writeJson(Utils.toJSONString(Map.of("id", "1", "title", "mytitle")), fw, true);++ String[] args = {+ "post", "-c", collection, "-credentials", USER + ":" + PASS, jsonDoc.getAbsolutePath()+ };+ assertEquals(0, runTool(args));+ }+private int runTool(String[] args) throws Exception {Tool tool = findTool(args);assertTrue(tool instanceof PostTool);diff --git a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.javaindex 5ba4f287b88..398add31b90 100644--- a/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/SolrCloudExampleTest.java@@ -44,9 +44,10 @@ import org.slf4j.Logger;import org.slf4j.LoggerFactory;/**- * Emulates bin/solr -e cloud -noprompt; bin/post -c gettingstarted example/exampledocs/*.xml; this- * test is useful for catching regressions in indexing the example docs in collections that use data- * driven functionality and managed schema features of the default configset (configsets/_default).+ * Emulates bin/solr start -e cloud -noprompt; bin/solr post -c gettingstarted+ * example/exampledocs/*.xml; this test is useful for catching regressions in indexing the example+ * docs in collections that use data driven functionality and managed schema features of the default+ * configset (configsets/_default).*/public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {@@ -114,7 +115,7 @@ public class SolrCloudExampleTest extends AbstractFullDistribZkTestBase {invalidToolExitStatus,tool.runTool(cli));- // now index docs like bin/post would, but we can't use SimplePostTool because it uses+ // now index docs like bin/solr post would, but we can't use SimplePostTool because it uses// System.exit when it encounters an error, which JUnit doesn't like ...log.info("Created collection, now posting example docs!");Path exampleDocsDir = Path.of(ExternalPaths.SOURCE_HOME, "example", "exampledocs");diff --git a/solr/docker/scripts/solr-demo b/solr/docker/scripts/solr-demoindex 8afdabe44f4..15fb87b45f3 100755--- a/solr/docker/scripts/solr-demo+++ b/solr/docker/scripts/solr-demo@@ -37,13 +37,9 @@ else/opt/solr/bin/solr create -c "$CORE"echo "Created $CORE"echo "Loading example data"- post_args=()- if [[ -n "${SOLR_PORT:-}" ]]; then- post_args+=(-p "$SOLR_PORT")- fi- /opt/solr/bin/post "${post_args[@]}" -c $CORE -commit no example/exampledocs/*.xml- /opt/solr/bin/post "${post_args[@]}" -c $CORE -commit no example/exampledocs/books.json- /opt/solr/bin/post "${post_args[@]}" -c $CORE -commit yes example/exampledocs/books.csv+ /opt/solr/bin/solr post -c $CORE -commit no example/exampledocs/*.xml+ /opt/solr/bin/solr post -c $CORE -commit no example/exampledocs/books.json+ /opt/solr/bin/solr post -c $CORE -commit yes example/exampledocs/books.csvecho "Loaded example data"stop-local-solrdiff --git a/solr/docker/tests/cases/create_core/test.sh b/solr/docker/tests/cases/create_core/test.shindex 9d23e55fccc..73ff298aad1 100755--- a/solr/docker/tests/cases/create_core/test.sh+++ b/solr/docker/tests/cases/create_core/test.sh@@ -25,7 +25,7 @@ docker run --name "$container_name" -d "$tag" solr-create -c gettingstartedwait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c gettingstarted example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c gettingstarted -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/gettingstarted/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/create_core_exec/test.sh b/solr/docker/tests/cases/create_core_exec/test.shindex 6f423b85ab6..f625dca4dc2 100755--- a/solr/docker/tests/cases/create_core_exec/test.sh+++ b/solr/docker/tests/cases/create_core_exec/test.sh@@ -27,7 +27,7 @@ wait_for_container_and_solr "$container_name"echo "Creating core"docker exec --user=solr "$container_name" bin/solr create -c gettingstartedecho "Loading data"-docker exec --user=solr "$container_name" bin/post -c gettingstarted example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c gettingstarted -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/gettingstarted/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/create_core_randomuser_rootgroup/test.sh b/solr/docker/tests/cases/create_core_randomuser_rootgroup/test.shindex 281683e666c..a777e061eb6 100755--- a/solr/docker/tests/cases/create_core_randomuser_rootgroup/test.sh+++ b/solr/docker/tests/cases/create_core_randomuser_rootgroup/test.sh@@ -27,7 +27,7 @@ docker run --user 7777:0 --name "$container_name" -d "$tag" solr-create -c gettiwait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c gettingstarted example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c gettingstarted -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/gettingstarted/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/empty-varsolr-dir-ramdomuser-rootgroup/test.sh b/solr/docker/tests/cases/empty-varsolr-dir-ramdomuser-rootgroup/test.shindex 37f150ddf1b..90dc4c495fc 100755--- a/solr/docker/tests/cases/empty-varsolr-dir-ramdomuser-rootgroup/test.sh+++ b/solr/docker/tests/cases/empty-varsolr-dir-ramdomuser-rootgroup/test.sh@@ -32,7 +32,7 @@ docker run \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c getting-started example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c getting-started -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/getting-started/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/empty-varsolr-dir-solr/test.sh b/solr/docker/tests/cases/empty-varsolr-dir-solr/test.shindex 155b135f3b9..aee5986a93f 100755--- a/solr/docker/tests/cases/empty-varsolr-dir-solr/test.sh+++ b/solr/docker/tests/cases/empty-varsolr-dir-solr/test.sh@@ -31,7 +31,7 @@ docker run \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c getting-started example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c getting-started -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/getting-started/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/empty-varsolr-dir-user/test.sh b/solr/docker/tests/cases/empty-varsolr-dir-user/test.shindex e9d42f75ba9..25d7f99ac66 100755--- a/solr/docker/tests/cases/empty-varsolr-dir-user/test.sh+++ b/solr/docker/tests/cases/empty-varsolr-dir-user/test.sh@@ -32,7 +32,7 @@ docker run \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c getting-started example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c getting-started -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/getting-started/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/empty-varsolr-vol-ramdomuser-rootgroup/test.sh b/solr/docker/tests/cases/empty-varsolr-vol-ramdomuser-rootgroup/test.shindex 402a66acbd8..6bd50085542 100755--- a/solr/docker/tests/cases/empty-varsolr-vol-ramdomuser-rootgroup/test.sh+++ b/solr/docker/tests/cases/empty-varsolr-vol-ramdomuser-rootgroup/test.sh@@ -36,7 +36,7 @@ docker run \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c getting-started example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c getting-started -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/getting-started/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/empty-varsolr-vol-solr-nocopy/test.sh b/solr/docker/tests/cases/empty-varsolr-vol-solr-nocopy/test.shindex 11dc15416c0..d6e3e1a9063 100755--- a/solr/docker/tests/cases/empty-varsolr-vol-solr-nocopy/test.sh+++ b/solr/docker/tests/cases/empty-varsolr-vol-solr-nocopy/test.sh@@ -42,7 +42,7 @@ docker run \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c getting-started example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c getting-started -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/getting-started/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/empty-varsolr-vol-solr/test.sh b/solr/docker/tests/cases/empty-varsolr-vol-solr/test.shindex 6a6416d7f00..fe12c869caa 100755--- a/solr/docker/tests/cases/empty-varsolr-vol-solr/test.sh+++ b/solr/docker/tests/cases/empty-varsolr-vol-solr/test.sh@@ -35,7 +35,7 @@ docker run \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c getting-started example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c getting-started -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/getting-started/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/empty-varsolr-vol-user/test.sh b/solr/docker/tests/cases/empty-varsolr-vol-user/test.shindex 26fa5505778..7e3e615dd86 100755--- a/solr/docker/tests/cases/empty-varsolr-vol-user/test.sh+++ b/solr/docker/tests/cases/empty-varsolr-vol-user/test.sh@@ -44,7 +44,7 @@ docker run \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c getting-started example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c getting-started -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/getting-started/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/gosu/test.sh b/solr/docker/tests/cases/gosu/test.shindex 657a0446033..1a3f5aacfa6 100755--- a/solr/docker/tests/cases/gosu/test.sh+++ b/solr/docker/tests/cases/gosu/test.sh@@ -38,7 +38,7 @@ docker run --user 0:0 --name "$container_name" -d -e VERBOSE=yes \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c gettingstarted example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c gettingstarted -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/gettingstarted/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/precreate_core/test.sh b/solr/docker/tests/cases/precreate_core/test.shindex ab314186f7d..f9f766bd024 100755--- a/solr/docker/tests/cases/precreate_core/test.sh+++ b/solr/docker/tests/cases/precreate_core/test.sh@@ -25,7 +25,7 @@ docker run --name "$container_name" -d -e VERBOSE=yes "$tag" solr-precreate gettwait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c gettingstarted example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c gettingstarted -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/gettingstarted/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/precreate_core_randomuser_rootgroup/test.sh b/solr/docker/tests/cases/precreate_core_randomuser_rootgroup/test.shindex 633929d785c..008aab98376 100755--- a/solr/docker/tests/cases/precreate_core_randomuser_rootgroup/test.sh+++ b/solr/docker/tests/cases/precreate_core_randomuser_rootgroup/test.sh@@ -30,7 +30,7 @@ docker run \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c gettingstarted example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c gettingstarted -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/gettingstarted/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/test_log4j/test.sh b/solr/docker/tests/cases/test_log4j/test.shindex 78f3a5856d9..31a66a8e8b0 100755--- a/solr/docker/tests/cases/test_log4j/test.sh+++ b/solr/docker/tests/cases/test_log4j/test.sh@@ -29,7 +29,7 @@ docker run --name "$container_name" -d -e VERBOSE=yes \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c gettingstarted example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c gettingstarted -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/gettingstarted/select?q=id%3Adell')diff --git a/solr/docker/tests/cases/user_volume/test.sh b/solr/docker/tests/cases/user_volume/test.shindex 92544518f85..3fa2fdeb524 100755--- a/solr/docker/tests/cases/user_volume/test.sh+++ b/solr/docker/tests/cases/user_volume/test.sh@@ -67,7 +67,7 @@ docker run \wait_for_container_and_solr "$container_name"echo "Loading data"-docker exec --user=solr "$container_name" bin/post -c mycore example/exampledocs/manufacturers.xml+docker exec --user=solr "$container_name" bin/solr post -c mycore -commit example/exampledocs/manufacturers.xmlsleep 1echo "Checking data"data=$(docker exec --user=solr "$container_name" wget -q -O - 'http://localhost:8983/solr/mycore/select?q=id%3Adell')diff --git a/solr/example/README.md b/solr/example/README.mdindex f7a9b76135b..a08dec53ba8 100644--- a/solr/example/README.md+++ b/solr/example/README.md@@ -48,10 +48,10 @@ After starting a Solr example, direct your Web browser to:http://localhost:8983/solr/```-To add documents to the index, use bin/post, for example:+To add documents to the index, use bin/solr post, for example:```- bin/post -c techproducts example/exampledocs/*.xml+ bin/solr post -c techproducts example/exampledocs/*.xml```(where "techproducts" is the Solr core name)diff --git a/solr/example/exampledocs/utf8-example.xml b/solr/example/exampledocs/utf8-example.xmlindex ee300a68306..e785b38199b 100644--- a/solr/example/exampledocs/utf8-example.xml+++ b/solr/example/exampledocs/utf8-example.xml@@ -17,7 +17,7 @@--><!--- After posting this to Solr with bin/post, searching for "êâîôû" from+ After posting this to Solr with bin/solr post, searching for "êâîôû" fromthe solr/admin/ search page must return this document.-->@@ -39,4 +39,3 @@<field name="inStock">true</field></doc></add>-diff --git a/solr/packaging/test/test_post.bats b/solr/packaging/test/test_post.batsindex 1e7651c2f30..2b8aea92a8f 100644--- a/solr/packaging/test/test_post.bats+++ b/solr/packaging/test/test_post.bats@@ -39,7 +39,7 @@ teardown() {@test "Check help command" {run solr post- assert_output --partial 'Failed to parse command-line arguments due to: Missing required option: url'+ assert_output --partial 'Must specify either -url or -c parameter'run solr post -hassert_output --partial 'usage: post'@@ -63,6 +63,17 @@ teardown() {refute_output --partial 'ERROR'}+@test "basic post with c parameter instead of url parameter" {++ run solr create -c monitors_c_param -d _default+ assert_output --partial "Created collection 'monitors_c_param'"++ run solr post -type application/xml -c monitors_c_param ${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 _defaultdiff --git a/solr/prometheus-exporter/src/test-files/exampledocs/utf8-example.xml b/solr/prometheus-exporter/src/test-files/exampledocs/utf8-example.xmlindex ee300a68306..e785b38199b 100644--- a/solr/prometheus-exporter/src/test-files/exampledocs/utf8-example.xml+++ b/solr/prometheus-exporter/src/test-files/exampledocs/utf8-example.xml@@ -17,7 +17,7 @@--><!--- After posting this to Solr with bin/post, searching for "êâîôû" from+ After posting this to Solr with bin/solr post, searching for "êâîôû" fromthe solr/admin/ search page must return this document.-->@@ -39,4 +39,3 @@<field name="inStock">true</field></doc></add>-diff --git a/solr/solr-ref-guide/modules/deployment-guide/pages/docker-networking.adoc b/solr/solr-ref-guide/modules/deployment-guide/pages/docker-networking.adocindex 364f06b1042..e5cfce63616 100644--- a/solr/solr-ref-guide/modules/deployment-guide/pages/docker-networking.adoc+++ b/solr/solr-ref-guide/modules/deployment-guide/pages/docker-networking.adoc@@ -204,7 +204,7 @@ To load data, and see it was split over shards:[source,bash,subs="attributes"]-----docker exec -it --user=solr zksolr1 bin/post -c my_collection1 example/exampledocs/manufacturers.xml+docker exec -it --user=solr zksolr1 bin/solr post -c my_collection1 example/exampledocs/manufacturers.xml# /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -classpath /opt/solr/server/lib/ext/*:/opt/solr/server/solr-webapp/webapp/WEB-INF/lib/* -Dauto=yes -Dc=my_collection1 -Ddata=files org.apache.solr.cli.SimplePostTool example/exampledocs/manufacturers.xml# SimplePostTool version {solr-full-version}# Posting files to [base] url http://localhost:8983/solr/my_collection1/update...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.adocindex 8f37e297769..f7f6763d0dd 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@@ -146,8 +146,8 @@ If you ran through the xref:getting-started:solr-tutorial.adoc[], you have alreaHere are the examples included with Solr:exampledocs::-This is a small set of simple CSV, XML, and JSON files that can be used with `bin/post` when first getting started with Solr.-For more information about using `bin/post` with these files, see xref:indexing-guide:post-tool.adoc[].+This is a small set of simple CSV, XML, and JSON files that can be used with `bin/solr post` when first getting started with Solr.+For more information about using `bin/solr post` with these files, see xref:indexing-guide:post-tool.adoc[].files::The `files` directory provides a basic search UI for documents such as Word or PDF that you may have stored locally.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.adocindex 57d4197b740..8a953676e99 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@@ -49,8 +49,8 @@ You may need to iterate on indexing a few times before you get the schema right.Solr has lots of ways to index data.Choose one of the approaches below and try it out with your system:-Local Files with `bin/post`::-If you have a local directory of files, the Post Tool (`bin/post`) can index a directory of files.+Local Files with `bin/solr post`::+If you have a local directory of files, the Post Tool (`bin/solr post`) can index a directory of files.We saw this in action in our first exercise.+We used only JSON, XML and CSV in our exercises, but the Post Tool can also handle HTML, PDF, Microsoft Office formats (such as MS Word), plain text, and more.@@ -60,7 +60,7 @@ To index it, we would issue a command like this (correcting the collection name+[,console]-----$ bin/post -c localDocs ~/Documents+$ bin/solr post -c localDocs ~/Documents----+You may get errors as it works through your documents.@@ -87,7 +87,7 @@ You can see that has happened by looking at the values for `numDocs` and `maxDocThe `maxDoc` value may be larger as the `maxDoc` count includes logically deleted documents that have not yet been physically removed from the index.You can re-post the sample files over and over again as much as you want and `numDocs` will never increase, because the new documents will constantly be replacing the old.-Go ahead and edit any of the existing example data files, change some of the data, and re-run the PostTool (`bin/post`).+Go ahead and edit any of the existing example data files, change some of the data, and re-run the PostTool (`bin/solr post`).You'll see your changes reflected in subsequent searches.=== Deleting Data@@ -97,20 +97,20 @@ Note, however, that merely removing documents doesn't change the underlying fielEssentially, this will allow you to reindex your data after making changes to fields for your needs.You can delete data by POSTing a delete command to the update URL and specifying the value of the document's unique key field, or a query that matches multiple documents (be careful with that one!).-We can use `bin/post` to delete documents also if we structure the request properly.+We can use `bin/solr post` to delete documents also if we structure the request properly.Execute the following command to delete a specific document:[,console]-----$ bin/post -c localDocs -d "<delete><id>SP2514N</id></delete>"+$ bin/solr post -c localDocs -d "<delete><id>SP2514N</id></delete>"----To delete all documents, you can use "delete-by-query" command like:[,console]-----$ bin/post -c localDocs -d "<delete><query>*:*</query></delete>"+$ bin/solr post -c localDocs -d "<delete><query>*:*</query></delete>"----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.adocindex e785ebd9c46..a202422f1e4 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@@ -227,7 +227,7 @@ Pick one of the formats and index it into the "films" collection (in each exampl[,console]-----$ bin/post -c films example/films/films.json+$ bin/solr post -c films example/films/films.json----====@@ -253,7 +253,7 @@ $ bin/solr post -c films example\films\films.json[,console]-----$ bin/post -c films example/films/films.xml+$ bin/solr post -c films example/films/films.xml----====@@ -279,7 +279,7 @@ $ java -jar -Dc=films -Dauto example\exampledocs\post.jar example\films\*.xml[,console]-----$ bin/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=|"----====@@ -309,9 +309,7 @@ Each command will produce output similar to the below seen while indexing JSON:[,console]-----$ bin/post -c films example/films/films.json-# bin/java -classpath /solr-{solr-full-version}/server/solr-webapp/webapp/WEB-INF/lib/solr-core-{solr-full-version}.jar -Dauto=yes -Dc=films -Ddata=files org.apache.solr.cli.SimplePostTool example/films/films.json-SimplePostTool version 5.0.0+$ bin/solr post -c films example/films/films.jsonPosting files to [base] url http://localhost:8983/solr/films/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,logPOSTing file films.json (application/json) to [base]/json/docsdiff --git a/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adoc b/solr/solr-ref-guide/modules/getting-started/pages/tutorial-techproducts.adocindex 2994bc905af..b2cb956a2ae 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@@ -159,21 +159,18 @@ image::solr-tutorial/tutorial-solrcloud.png[]Your Solr server is up and running, but it doesn't contain any data yet, so we can't do any queries.-Solr includes the `bin/post` tool in order to facilitate indexing various types of documents easily.+Solr includes the `bin/solr post` tool in order to facilitate indexing various types of documents easily.We'll use this tool for the indexing examples below.You'll need a command shell to run some of the following examples, rooted in the Solr install directory; the shell from where you launched Solr works just fine.-NOTE: Currently the `bin/post` tool does not have a comparable Windows script, but the `bin/solr post` command is available on Windows.-See the section xref:indexing-guide:post-tool.adoc[] for more information.-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:.Linux/Mac[,console]-----$ bin/post -c techproducts example/exampledocs/*+$ bin/solr post -c techproducts example/exampledocs/*----.Windowsdiff --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.adocindex 4ba4f52f26f..d32fe2b7b75 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@@ -124,11 +124,11 @@ The `@` symbol instructs curl to upload the attached file.* The argument `myfile=@example/exampledocs/solr-word.pdf` uploads the sample file.Note this includes the path, so if you upload a different file, always be sure to include either the relative or absolute path to the file.-You can also use `bin/post` to do the same thing:+You can also use `bin/solr post` to do the same thing:[source,bash]-----bin/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`.@@ -148,7 +148,7 @@ Here's an example:[source,bash]-----bin/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]@@ -563,7 +563,7 @@ The command below captures `<div>` tags separately (`capture=div`), and then map[source,bash]-----bin/post -c gettingstarted example/exampledocs/sample.html -params "literal.id=doc2&captureAttr=true&defaultField=_text_&fmap.div=foo_t&capture=div"+bin/solr post -c gettingstarted example/exampledocs/sample.html -params "literal.id=doc2&captureAttr=true&defaultField=_text_&fmap.div=foo_t&capture=div"----=== Using Literals to Define Custom Metadata@@ -572,7 +572,7 @@ To add in your own metadata, pass in the literal parameter along with the file:[source,bash]-----bin/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.@@ -584,7 +584,7 @@ The example below passes in an XPath expression to restrict the XHTML returned b[source,bash]-----bin/post -c gettingstarted -params "literal.id=doc5&captureAttr=true&defaultField=text&capture=div&fmap.div=foo_t&xpath=/xhtml:html/xhtml:body/xhtml:div//node()" example/exampledocs/sample.html+bin/solr post -c gettingstarted -params "literal.id=doc5&captureAttr=true&defaultField=text&capture=div&fmap.div=foo_t&xpath=/xhtml:html/xhtml:body/xhtml:div//node()" example/exampledocs/sample.html----=== Extracting Data without Indexing@@ -603,7 +603,7 @@ The output includes XML generated by Tika (and further escaped by Solr's XML) us[source,bash]-----bin/post -c gettingstarted -params "extractOnly=true&wt=ruby&indent=true" -out yes example/exampledocs/sample.html+bin/solr post -c gettingstarted -params "extractOnly=true&wt=ruby&indent=true" -out yes example/exampledocs/sample.html----=== Using Solr Cell with a POST Requestdiff --git a/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adoc b/solr/solr-ref-guide/modules/indexing-guide/pages/post-tool.adocindex c1ef5876923..b3d1f48ed89 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@@ -16,14 +16,11 @@// specific language governing permissions and limitations// under the License.-Solr includes a simple command line tool for POSTing various types of content to a Solr server.--The tool is `bin/solr post`.-The bin/solr post tool is a Unix shell script; for Windows (non-Cygwin) usage,use `bin/solr.cmd post`.+Solr includes a simple command line tool for POSTing various types of content to a Solr server that is part of the `bin/solr` CLI.NOTE: This tool is meant for use by new users exploring Solr's capabilities, and is not intended as a robust solution to be used for indexing documents into production systems.-NOTE: You may be familiar with SimplePostTool and the bin/post Unix shell script. While this is still available, it is deprecated and will be removed in Solr 10.+NOTE: You may be familiar with SimplePostTool and the `bin/post` Unix shell script. While this is still available, it is deprecated and will be removed in Solr 10.To run it, open a window and enter:@@ -38,7 +35,10 @@ The `-help` (or simply `-h`) option will output information on its usage (i.e.,== Using the bin/solr post Tool-Specifying the full update `url` is *mandatory* when using `bin/solr post`.+You must either specify `url` that is the full path to the update handler or provide a `c` collection/core name when using `bin/solr post`.++This specifies the same target collection: `-url http://localhost:8983/gettingstarted/update` or `-c gettingstarted`.+The basic usage of `bin/solr post` is:@@ -118,7 +118,7 @@ Index all CSV and JSON files into `gettingstarted` from current directory:[source,bash]-----bin/solr post -url http://localhost:8983/solr/gettingstarted/update -filetypes json,csv .+bin/solr post -c gettingstarted -filetypes json,csv .----Index a tab-separated file into `gettingstarted`: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.adocindex dadaeef4cb1..4b25e51a9c9 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@@ -68,10 +68,10 @@ However, it's much bulkier than the raw coordinates for such simple data.=== Indexing GeoJSON and WKT-Using the `bin/post` tool:+Using the `bin/solr post` tool:[source,text]-bin/post -type "application/json" -url "http://localhost:8983/solr/mycollection/update?format=geojson" /path/to/geojson.file+bin/solr post -type "application/json" -url "http://localhost:8983/solr/mycollection/update?format=geojson" /path/to/geojson.fileThe key parameter to pass in with your request is: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.adocindex 81b0f176779..31ef089f593 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@@ -274,10 +274,10 @@ should be almost 7MB file expanding to a cities1000.txt file around22.2MB containing 145k lines, each a city in the world of at least 1000population.-Using bin/post:+Using bin/solr post:[source,bash]-----bin/post -c geonames -type text/csv \+bin/solr post -c geonames -type 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----