Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 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
ca2d06b
Merge remote-tracking branch 'upstream/main' into copilot/migrate-upd…
janhoy Sep 24, 2026
ac83841
Deal with atomic updates that we don't support with an error.
epugh Sep 25, 2026
ba5bb51
Deal with atomic updates that we don't support with an error.
epugh Sep 25, 2026
ddffebb
Merge branch 'copilot/migrate-update-api-to-jax-rs' of github.com:epu…
epugh Sep 25, 2026
00ad6ef
UpdateProcessors can add to the header, and this converts that to str…
epugh Sep 25, 2026
675e724
Deal with v2 api "re-entering twice" the V1 handleRequest by pulling …
epugh Sep 25, 2026
8a51c10
Revamp openapi generation to not assume content-type
epugh Sep 25, 2026
3198bb2
I hacked up not realizing the tail part!
epugh Sep 25, 2026
4fe0bb2
Deal with wt behavior internally.
epugh Sep 25, 2026
576a0c7
I suppose...
epugh Sep 25, 2026
ea3d27b
Much better changelog!
epugh Sep 25, 2026
d681a31
lint
epugh Sep 26, 2026
054fc61
Merge remote-tracking branch 'upstream/main' into pr-4177
janhoy Nov 10, 2026
8afa6bd
Pass the content type to the generated UploadConfigSet request in Cre…
janhoy Nov 10, 2026
b98bc2f
Ref Guide: align the V1/V2 update examples with the current curl conv…
janhoy Nov 10, 2026
107a5a9
Follow main: ContentStreamBase moved to solr-core, UploadFile callers…
janhoy Nov 10, 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
14 changes: 14 additions & 0 deletions changelog/unreleased/SOLR-18457-migrate-update-api-to-jax-rs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
title: >
Migrated the v2 update endpoints to JAX-RS. The v2 javabin endpoint is now /update/javabin,
where v1 uses the shorter /update/bin. Migrated the Admin UI's document-upload screen to use
these v2 endpoints. That screen now only supports the /update endpoint; it can no longer target
a custom endpoint. As part of updating the examples in the Ref Guide, the bundled techproducts
example schema also changed: "price" and "popularity" are now docValues-only (no longer indexed
or stored), the "price_c" copyField from "price" was removed, and nested/child-document support
("_nest_path_"/"_nest_parent_") was added.
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Strict @Consumes means JAX-RS returns 415 for anything else before the handler runs, so assume.content.type (UpdateRequestHandler:78) no longer works on v2 -- the old @EndPoint version accepted any type and let the handler resolve it. Worth deciding deliberately rather than losing it as a side effect.

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.

Yeah, so the update.contentType feels like some next level hacking? I am going to send you json, but I can't send a header to tell you it's json? Seems like we want to stick with how Jersey views the world as much as possible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agree, update.contentType is not necessary to support in 2026, it was never a good idea with a solr-custom method of declaring content type. Let the request-param DIE, it is experimental anyway, right? :) Perfect for a spinoff JIRA/PR.

@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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

v1 has a /update/cbor convenience path and /update consumes CBOR here, but there's no v2 CBOR path alongside /json, /xml, /csv, /javabin. Deliberate?

})
@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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The generated SolrJ Java client can't call this -- new UpdateApi.Update(IndexType.CORE, coll, stream) returns 415, same on /update/json.

The Java template hardcodes getContentType() to application/octet-stream, which none of the @Consumes above accept. The JS generator emits the real consumes list, which is why the Admin UI works and this went unnoticed. Since /update picks its loader by Content-Type, the caller needs to control the header.

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 hate touching the mustache templates, but this one seems pretty clear cut: 8a51c10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Followup question - if our SolrJ classes use the generated Java client from these templates, do we have test coverage on those SolrJ classes that would have caught this. I guess we have no SolrJ test attempting cbor encoding, since cbor is for other client languages -- solrj has javabin..

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,39 @@
/*
* 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 single add/delete/delete-by-query that failed but was tolerated because the request's {@code
* maxErrors} allowed it.
*/
public class ToleratedUpdateError {

@JsonProperty("type")
@Schema(description = "The kind of command that failed, e.g. 'ADD', 'DELID', or 'DELQ'.")
public String type;

@JsonProperty("id")
@Schema(description = "The document id or delete-by-query expression that failed.")
public String id;

@JsonProperty("message")
@Schema(description = "The error message describing why the command failed.")
public String message;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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;

@JsonProperty("errors")
@Schema(
description =
"Commands that failed but were tolerated because the request's maxErrors allowed it. "
+ "Present only when the update chain includes a tolerant-update processor.")
public List<ToleratedUpdateError> errors;

@JsonProperty("maxErrors")
@Schema(
description =
"The effective maxErrors value used for this request; -1 means unlimited. Present only "
+ "when the update chain includes a tolerant-update processor.")
public Integer maxErrors;

@JsonProperty("rf")
@Schema(
description =
"The replication factor actually achieved for this update. Present only in SolrCloud.")
public Integer rf;
}
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;
}
2 changes: 1 addition & 1 deletion solr/core/src/java/org/apache/solr/cli/CreateTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ private void createCollection(CloudSolrClient cloudSolrClient, CreateParams para
+ " using the Configsets V2 API");
var uploadReq =
new ConfigsetsApi.UploadConfigSet(
confName, new ByteArrayInputStream(Utils.zipDirectory(confPath)));
confName, new ByteArrayInputStream(Utils.zipDirectory(confPath)), "application/zip");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Constant instead of string? Either from Jetty or from JDK

uploadReq.process(cloudSolrClient);
}

Expand Down
Loading
Loading