You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/08/21 06:47:34 UTC
[05/10] lucene-solr:feature/autoscaling: SOLR-11183: V2 APIs are now
available at /api endpoint
SOLR-11183: V2 APIs are now available at /api endpoint
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c8e0e939
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c8e0e939
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c8e0e939
Branch: refs/heads/feature/autoscaling
Commit: c8e0e939e496d0e77994e010d1eb436613dd66b7
Parents: b498b08
Author: Ishan Chattopadhyaya <is...@apache.org>
Authored: Sun Aug 20 21:00:15 2017 +0530
Committer: Ishan Chattopadhyaya <is...@apache.org>
Committed: Sun Aug 20 21:00:15 2017 +0530
----------------------------------------------------------------------
dev-tools/scripts/smokeTestRelease.py | 2 +-
solr/CHANGES.txt | 5 +++
solr/server/etc/jetty.xml | 8 ++++
solr/solr-ref-guide/src/v2-api.adoc | 42 ++++++++++----------
.../solr/client/solrj/impl/HttpSolrClient.java | 2 +-
5 files changed, 36 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c8e0e939/dev-tools/scripts/smokeTestRelease.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py
index 01706a7..b7ca972 100644
--- a/dev-tools/scripts/smokeTestRelease.py
+++ b/dev-tools/scripts/smokeTestRelease.py
@@ -861,7 +861,7 @@ def testSolrExample(unpackPath, javaPath, isSrc):
if s.find('"numFound":3,"start":0') == -1:
print('FAILED: response is:\n%s' % s)
raise RuntimeError('query on solr example instance failed')
- s = load('http://localhost:8983/v2/cores')
+ s = load('http://localhost:8983/api/cores')
if s.find('"status":0,') == -1:
print('FAILED: response is:\n%s' % s)
raise RuntimeError('query api v2 on solr example instance failed')
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c8e0e939/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index d07b085..a910fc6 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -294,6 +294,9 @@ Upgrading from Solr 6.x
* SOLR-11239: The use of maxShardsPerNode is not supported when a cluster policy is in effect or
when a collection specific policy is specified during collection creation.
+* V2 APIs are now available at /api, in addition to /v2 (which is now deprecated). Legacy APIs continue to remain
+ available at /solr.
+
New Features
----------------------
* SOLR-9857, SOLR-9858: Collect aggregated metrics from nodes and shard leaders in overseer. (ab)
@@ -678,6 +681,8 @@ Other Changes
collection specific policy is specified during collection creation.
(Noble Paul, shalin)
+* SOLR-11183: V2 APIs are now available at /api endpoint. (Ishan Chattopadhyaya)
+
================== 6.7.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c8e0e939/solr/server/etc/jetty.xml
----------------------------------------------------------------------
diff --git a/solr/server/etc/jetty.xml b/solr/server/etc/jetty.xml
index b512c51..1f6de77 100644
--- a/solr/server/etc/jetty.xml
+++ b/solr/server/etc/jetty.xml
@@ -105,6 +105,14 @@
</New>
</Arg>
</Call>
+ <Call name="addRule">
+ <Arg>
+ <New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
+ <Set name="pattern">/api/*</Set>
+ <Set name="replacement">/solr/____v2</Set>
+ </New>
+ </Arg>
+ </Call>
<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c8e0e939/solr/solr-ref-guide/src/v2-api.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/v2-api.adoc b/solr/solr-ref-guide/src/v2-api.adoc
index 15e1fda..6fbc168 100644
--- a/solr/solr-ref-guide/src/v2-api.adoc
+++ b/solr/solr-ref-guide/src/v2-api.adoc
@@ -41,38 +41,38 @@ Following are some v2 API URL paths and path prefixes, along with some of the op
[width="100%",options="header",]
|===
|Path prefix |Some Supported Operations
-|`/v2/collections` or equivalently: `/v2/c` |Create, alias, backup, and restore a collection.
-|`/v2/c/_collection-name_/update` |Update requests.
-|`/v2/c/_collection-name_/config` |Configuration requests.
-|`/v2/c/_collection-name_/schema` |Schema requests.
-|`/v2/c/_collection-name_/_handler-name_` |Handler-specific requests.
-|`/v2/c/_collection-name_/shards` |Split a shard, create a shard, add a replica.
-|`/v2/c/_collection-name_/shards/_shard-name_` |Delete a shard, force leader election
-|`/v2/c/_collection-name_/shards/_shard-name_/_replica-name_` |Delete a replica.
-|`/v2/cores` |Create a core.
-|`/v2/cores/_core-name_` |Reload, rename, delete, and unload a core.
-|`/v2/node` |Perform overseer operation, rejoin leader election.
-|`/v2/cluster` |Add role, remove role, set cluster property.
-|`/v2/c/.system/blob` |Upload and download blobs and metadata.
+|`/api/collections` or equivalently: `/api/c` |Create, alias, backup, and restore a collection.
+|`/api/c/_collection-name_/update` |Update requests.
+|`/api/c/_collection-name_/config` |Configuration requests.
+|`/api/c/_collection-name_/schema` |Schema requests.
+|`/api/c/_collection-name_/_handler-name_` |Handler-specific requests.
+|`/api/c/_collection-name_/shards` |Split a shard, create a shard, add a replica.
+|`/api/c/_collection-name_/shards/_shard-name_` |Delete a shard, force leader election
+|`/api/c/_collection-name_/shards/_shard-name_/_replica-name_` |Delete a replica.
+|`/api/cores` |Create a core.
+|`/api/cores/_core-name_` |Reload, rename, delete, and unload a core.
+|`/api/node` |Perform overseer operation, rejoin leader election.
+|`/api/cluster` |Add role, remove role, set cluster property.
+|`/api/c/.system/blob` |Upload and download blobs and metadata.
|===
== Introspect
Append `/_introspect` to any valid v2 API path and the API specification will be returned in JSON format.
-`\http://localhost:8983/v2/c/_introspect`
+`\http://localhost:8983/api/c/_introspect`
To limit the introspect output to include just one particular HTTP method, add request param `method` with value `GET`, `POST`, or `DELETE`.
-`\http://localhost:8983/v2/c/_introspect?method=POST`
+`\http://localhost:8983/api/c/_introspect?method=POST`
Most endpoints support commands provided in a body sent via POST. To limit the introspect output to only one command, add request param `command=_command-name_` .
-`\http://localhost:8983/v2/c/gettingstarted/_introspect?method=POST&command=modify`
+`\http://localhost:8983/api/c/gettingstarted/_introspect?method=POST&command=modify`
=== Interpreting the Introspect Output
-Example : `\http://localhost:8983/v2/c/gettingstarted/get/_introspect`
+Example : `\http://localhost:8983/api/c/gettingstarted/get/_introspect`
[source,json]
----
@@ -107,7 +107,7 @@ Description of some of the keys in the above example:
* `**spec/url/params**` : List of supported URL request params
* `**availableSubPaths**` : List of valid URL subpaths and the HTTP method(s) each supports
-Example of introspect for a POST API: `\http://localhost:8983/v2/c/gettingstarted/_introspect?method=POST&command=modify`
+Example of introspect for a POST API: `\http://localhost:8983/api/c/gettingstarted/_introspect?method=POST&command=modify`
[source,json]
----
@@ -161,7 +161,7 @@ For the "gettingstarted" collection, set the replication factor and whether to a
[source,bash]
----
-$ curl http://localhost:8983/v2/c/gettingstarted -H 'Content-type:application/json' -d '
+$ curl http://localhost:8983/api/c/gettingstarted -H 'Content-type:application/json' -d '
{ modify: { replicationFactor: "3", autoAddReplicas: false } }'
{"responseHeader":{"status":0,"QTime":842}}
@@ -171,7 +171,7 @@ See the state of the cluster:
[source,bash]
----
-$ curl http://localhost:8983/v2/cluster
+$ curl http://localhost:8983/api/cluster
{"responseHeader":{"status":0,"QTime":0},"collections":["gettingstarted",".system"]}
----
@@ -180,7 +180,7 @@ Set a cluster property:
[source,bash]
----
-$ curl http://localhost:8983/v2/cluster -H 'Content-type: application/json' -d '
+$ curl http://localhost:8983/api/cluster -H 'Content-type: application/json' -d '
{ set-property: { name: autoAddReplicas, val: "false" } }'
{"responseHeader":{"status":0,"QTime":4}}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c8e0e939/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
index 02d7c1a..b18a9b3 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
@@ -355,7 +355,7 @@ public class HttpSolrClient extends SolrClient {
if (request instanceof V2Request) {
if (System.getProperty("solr.v2RealPath") == null) {
- basePath = baseUrl.replace("/solr", "/v2");
+ basePath = baseUrl.replace("/solr", "/api");
} else {
basePath = baseUrl + "/____v2";
}