Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7b437c7
Initial plan
Copilot Mar 1, 2026
89fdf9d
Migrate UpdateAPI from @EndPoint to JAX-RS annotations
Copilot Mar 1, 2026
863fbf1
Add NodeHealthAPITest2 integration test for V2 node health API
Copilot Mar 2, 2026
f5e49ea
Fix TestDistributedTracing to use proper SolrJ add() instead of broke…
Copilot Mar 2, 2026
3b79fb8
Support /c/ path alias in JAX-RS routing for all V2 endpoints
Copilot Mar 2, 2026
014880c
Fix NPE in UpdateAPI: call pre/postDecorateResponse when delegating t…
Copilot Mar 2, 2026
3cc0acc
code warning cleanups
epugh Mar 2, 2026
e40d417
Lint
epugh Mar 2, 2026
92d70a8
We didn't need this.
epugh Mar 2, 2026
74bdf15
Properly route reqeusts by returning an empty getApis
epugh Mar 2, 2026
6a675bf
current v2 doesnt support multiple commands
epugh Mar 2, 2026
4d2cbc0
Relocate test to be in the same package as what we are testing.
epugh Mar 2, 2026
7337062
Add indexing-with-v2-apis.adoc documenting V2 update API endpoints
Copilot Mar 2, 2026
b932cb2
Tweak formatting
epugh Mar 2, 2026
055f200
Update solr/solr-ref-guide/modules/indexing-guide/pages/indexing-with…
epugh Mar 3, 2026
296f33a
relocate via intellij went werid
epugh Mar 3, 2026
090749a
Merge remote-tracking branch 'upstream/main' into copilot/migrate-upd…
epugh Sep 17, 2026
793eef0
/bin really should be /javabin. Open door to other binary protocols.
epugh Sep 17, 2026
9d87a15
Fixed this code, thanks copilot. Not committing the new tests that p…
epugh Sep 18, 2026
3dab0ef
add changelog
epugh Sep 18, 2026
3ed21dd
Restore the versions=true support that v1 equivalent has, and so did …
epugh Sep 18, 2026
6455c2e
add versions to the docs for v2... trying not to get too verbose.
epugh Sep 19, 2026
6b32a74
Our future is STC, not STCJ4
epugh Sep 19, 2026
cfb1d52
Now update parameters show up in annoations.
epugh Sep 19, 2026
d11876f
restore the /update end point being the root. will make v1 to v2 doc…
epugh Sep 19, 2026
162511f
Rework test to focus on compat between V1 and V2
epugh Sep 19, 2026
d904bef
Strong enough typing enabled to use generate V2 api in Solr Admin
epugh Sep 19, 2026
ec090e1
Due to limitation in v2 architecture for content types, by swapping t…
epugh Sep 19, 2026
7523441
fix the layout issue that has plagued this page where results showed …
epugh Sep 19, 2026
8723661
pretty print the sample raw json command by just formatting it here.
epugh Sep 19, 2026
9b00cce
No longer need v1 update
epugh Sep 19, 2026
8971144
string formatting is hard.
epugh Sep 19, 2026
37d6f22
better changelog
epugh Sep 19, 2026
0f23c24
Collapse seperate v2 into v1, and add javabin and version response info
epugh Sep 19, 2026
c783adb
Reorder and refactor the content.
epugh Sep 19, 2026
ed6bc2c
Updates to the transforming page for v2, and a test to ensure it works
epugh Sep 19, 2026
3a96567
Updated screenshot for v2 default api.
epugh Sep 19, 2026
0337730
Revamp partial doc updates to use real techproducts data and schema.
epugh Sep 20, 2026
8fc4bef
small tweak that reads better
epugh Sep 20, 2026
1de44e5
tighten test
epugh Sep 20, 2026
acca0f3
Deal with fall out of adding nesting to techproducts
epugh Sep 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: Migrate v2 update endpoints to JAX-RS and rename the Javabin endpoint to /update/javabin. Migrate Admin UI to using v2 endpoints, fixing UI issues in the document upload screen. Document screen only works with /upload endpoint, no longer can specify a custom endpoint.
type: changed
authors:
- name: Eric Pugh
links:
- name: SOLR-18457
url: https://issues.apache.org/jira/browse/SOLR-18457
211 changes: 211 additions & 0 deletions solr/api/src/java/org/apache/solr/client/api/endpoint/UpdateApi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.endpoint;

import static org.apache.solr.client.api.util.Constants.GENERIC_ENTITY_PROPERTY;
import static org.apache.solr.client.api.util.Constants.INDEX_PATH_PREFIX;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import java.io.InputStream;
import org.apache.solr.client.api.model.UpdateResponse;
import org.apache.solr.client.api.util.StoreApiParameters;

/** V2 API definitions for indexing documents via the update handler. */
@Path(INDEX_PATH_PREFIX + "/update")
public interface UpdateApi {

@POST
@Consumes({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big enhancement over the existing non JAX-RS appaoche, which required you to call /update/csv for cSV etc. Now we support content-types and you can access /update.

"application/json",
"text/json",
"application/xml",
"text/xml",
"application/csv",
"text/csv",
"application/javabin",
"application/cbor"
})
@StoreApiParameters
@Operation(
summary = "Send updates using any supported content type",
tags = {"update"})
UpdateResponse update(
@Parameter(description = "Commit the update immediately") @QueryParam("commit")
Boolean commit,
@Parameter(description = "Commit the update within this many milliseconds")
@QueryParam("commitWithin")
Integer commitWithin,
@Parameter(description = "Overwrite documents with the same unique key")
@QueryParam("overwrite")
Boolean overwrite,
@Parameter(description = "Perform a soft commit") @QueryParam("softCommit")
Boolean softCommit,
@Parameter(description = "Include assigned document versions in the response")
@QueryParam("versions")
Boolean versions,
@Parameter(required = true)
@RequestBody(
required = true,
description = "Update content in the format selected by the Content-Type header.",
extensions =
@Extension(
properties = {
@ExtensionProperty(name = GENERIC_ENTITY_PROPERTY, value = "true")
}))
InputStream requestBody)
throws Exception;

@POST
@Path("/json")
@Consumes({"application/json", "text/json"})
@StoreApiParameters
@Operation(
summary = "Index documents in JSON format",
tags = {"update"})
UpdateResponse updateJson(
@Parameter(description = "Commit the update immediately") @QueryParam("commit")
Boolean commit,
@Parameter(description = "Commit the update within this many milliseconds")
@QueryParam("commitWithin")
Integer commitWithin,
@Parameter(description = "Overwrite documents with the same unique key")
@QueryParam("overwrite")
Boolean overwrite,
@Parameter(description = "Perform a soft commit") @QueryParam("softCommit")
Boolean softCommit,
@Parameter(description = "Include assigned document versions in the response")
@QueryParam("versions")
Boolean versions,
@Parameter(required = true)
@RequestBody(
required = true,
description = "JSON update content.",
extensions =
@Extension(
properties = {
@ExtensionProperty(name = GENERIC_ENTITY_PROPERTY, value = "true")
}))
InputStream requestBody)
throws Exception;

@POST
@Path("/xml")
@Consumes({"application/xml", "text/xml"})
@StoreApiParameters
@Operation(
summary = "Index documents in XML format",
tags = {"update"})
UpdateResponse updateXml(
@Parameter(description = "Commit the update immediately") @QueryParam("commit")
Boolean commit,
@Parameter(description = "Commit the update within this many milliseconds")
@QueryParam("commitWithin")
Integer commitWithin,
@Parameter(description = "Overwrite documents with the same unique key")
@QueryParam("overwrite")
Boolean overwrite,
@Parameter(description = "Perform a soft commit") @QueryParam("softCommit")
Boolean softCommit,
@Parameter(description = "Include assigned document versions in the response")
@QueryParam("versions")
Boolean versions,
@Parameter(required = true)
@RequestBody(
required = true,
description = "XML update content.",
extensions =
@Extension(
properties = {
@ExtensionProperty(name = GENERIC_ENTITY_PROPERTY, value = "true")
}))
InputStream requestBody)
throws Exception;

@POST
@Path("/csv")
@Consumes({"application/csv", "text/csv"})
@StoreApiParameters
@Operation(
summary = "Index documents in CSV format",
tags = {"update"})
UpdateResponse updateCsv(
@Parameter(description = "Commit the update immediately") @QueryParam("commit")
Boolean commit,
@Parameter(description = "Commit the update within this many milliseconds")
@QueryParam("commitWithin")
Integer commitWithin,
@Parameter(description = "Overwrite documents with the same unique key")
@QueryParam("overwrite")
Boolean overwrite,
@Parameter(description = "Perform a soft commit") @QueryParam("softCommit")
Boolean softCommit,
@Parameter(description = "Include assigned document versions in the response")
@QueryParam("versions")
Boolean versions,
@Parameter(required = true)
@RequestBody(
required = true,
description = "CSV update content.",
extensions =
@Extension(
properties = {
@ExtensionProperty(name = GENERIC_ENTITY_PROPERTY, value = "true")
}))
InputStream requestBody)
throws Exception;

@POST
@Path("/javabin")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i debated leaving this on /update/bin to mimic more closing v1...

@Consumes("application/javabin")
@StoreApiParameters
@Operation(
summary = "Index documents in Javabin format",
tags = {"update"})
UpdateResponse updateJavabin(
@Parameter(description = "Commit the update immediately") @QueryParam("commit")
Boolean commit,
@Parameter(description = "Commit the update within this many milliseconds")
@QueryParam("commitWithin")
Integer commitWithin,
@Parameter(description = "Overwrite documents with the same unique key")
@QueryParam("overwrite")
Boolean overwrite,
@Parameter(description = "Perform a soft commit") @QueryParam("softCommit")
Boolean softCommit,
@Parameter(description = "Include assigned document versions in the response")
@QueryParam("versions")
Boolean versions,
@Parameter(required = true)
@RequestBody(
required = true,
description = "Javabin update content.",
extensions =
@Extension(
properties = {
@ExtensionProperty(name = GENERIC_ENTITY_PROPERTY, value = "true")
}))
InputStream requestBody)
throws Exception;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;

/** Version information returned by an update request with {@code versions=true}. */
public class UpdateResponse extends SolrJerseyResponse {

@JsonProperty("adds")
@Schema(description = "Documents added and the versions assigned to them.")
public List<VersionedDocument> adds;

@JsonProperty("deletes")
@Schema(description = "Documents deleted and the versions assigned to their delete operations.")
public List<VersionedDocument> deletes;

@JsonProperty("deleteByQuery")
@Schema(description = "Delete-by-query operations and the versions assigned to them.")
public List<VersionedQuery> deleteByQuery;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;

/** A document identifier and the version assigned to an update operation. */
public class VersionedDocument {

@JsonProperty("id")
@Schema(description = "The document's unique identifier.")
public String id;

@JsonProperty("version")
@Schema(description = "The version assigned to the operation.")
public long version;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.api.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;

/** A delete-by-query expression and the version assigned to the operation. */
public class VersionedQuery {

@JsonProperty("query")
@Schema(description = "The delete-by-query expression.")
public String query;

@JsonProperty("version")
@Schema(description = "The version assigned to the operation.")
public long version;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,34 @@
package org.apache.solr.handler;

import java.util.Collection;
import org.apache.solr.api.AnnotatedApi;
import java.util.List;
import org.apache.solr.api.Api;
import org.apache.solr.api.JerseyResource;
import org.apache.solr.handler.admin.api.UpdateAPI;
import org.apache.solr.jersey.APIConfigProvider;

/**
* An extension of {@link UpdateRequestHandler} used solely to register the v2 /update APIs
* An extension of {@link UpdateRequestHandler} used solely to register the v2 /update APIs.
*
* <p>At core-load time, Solr looks at each 'plugin' in ImplicitPlugins.json, fetches the v2 {@link
* Api} implementations associated with each RequestHandler, and registers them in an {@link
* org.apache.solr.api.ApiBag}. Since UpdateRequestHandler is mentioned multiple times in
* ImplicitPlugins.json (once for each update API: /update, /update/json, etc.), this would cause
* org.apache.solr.api.Api} implementations associated with each RequestHandler, and registers them
* in an {@link org.apache.solr.api.ApiBag}. Since UpdateRequestHandler is mentioned multiple times
* in ImplicitPlugins.json (once for each update API: /update, /update/json, etc.), this would cause
* the v2 APIs to be registered in duplicate. To avoid this, Solr has this RequestHandler, whose
* only purpose is to register the v2 APIs that conceptually should be associated with
* UpdateRequestHandler.
*/
public class V2UpdateRequestHandler extends UpdateRequestHandler {
public class V2UpdateRequestHandler extends UpdateRequestHandler
implements APIConfigProvider<UpdateAPI.UpdateRequestHandlerConfig> {

@Override
public Collection<Api> getApis() {
return AnnotatedApi.getApis(new UpdateAPI(this));
return List.of();
}

@Override
public Collection<Class<? extends JerseyResource>> getJerseyResources() {
return List.of(UpdateAPI.class);
}

@Override
Expand All @@ -49,4 +57,14 @@ public Boolean registerV1() {
public Boolean registerV2() {
return Boolean.TRUE;
}

@Override
public UpdateAPI.UpdateRequestHandlerConfig provide() {
return new UpdateAPI.UpdateRequestHandlerConfig(this);
}

@Override
public Class<UpdateAPI.UpdateRequestHandlerConfig> getConfigClass() {
return UpdateAPI.UpdateRequestHandlerConfig.class;
}
}
Loading
Loading