NationalSecurityAgency/ghidra · error · ElasticException

Unknown response trying to adjust number_of_replicas and ref

Error message

Unknown response trying to adjust number_of_replicas and refresh_interval

What it means

Thrown in adjustReplicaRefresh when the response to a PUT index/_settings request does not contain an "acknowledged" field (ElasticConnection.isNull(ack) is true). The standard Elasticsearch settings-update response includes an acknowledged boolean; its absence means the server returned a non-standard response, an error envelope, or an authentication challenge that was not caught as an HTTP-level failure.

Source

Thrown at Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java:1939

	 */
	private void adjustReplicaRefresh(String index, int numReplicas, int refreshRateInSecs)
			throws ElasticException {
		StringBuilder builder = new StringBuilder();
		builder.append("{ \"index\": { ");
		builder.append("  \"number_of_replicas\": ").append(numReplicas).append(", ");
		builder.append("  \"refresh_interval\": \"");
		if (refreshRateInSecs < 1) {
			builder.append("-1");		// Indicates that no refreshes are scheduled
		}
		else {
			builder.append(refreshRateInSecs).append('s');
		}
		builder.append("\" } }");
		JsonObject resp = connection.executeStatement(ElasticConnection.PUT, index + "/_settings",
			builder.toString());
		JsonElement ack = resp.get("acknowledged");
		if (ElasticConnection.isNull(ack)) {
			throw new ElasticException(
				"Unknown response trying to adjust number_of_replicas and refresh_interval");
		}
		if (!ack.getAsBoolean()) {
			throw new ElasticException("Cluster did not accept settings for index: " + index);
		}
	}

	/**
	 * This routine establishes the schema for the "vector" and "meta" document types
	 * for a new database. It also sets up weights and hashes for the vector tokenizer (lsh_tokenizer).
	 * @param config contains database configuration info
	 * @throws ElasticException for communication problems with the server
	 */
	private void createVectorIndex(Configuration config) throws ElasticException {
		StringBuilder builder = new StringBuilder();
		builder.append("{ \"settings\": { ");
		builder.append("  \"index\": { ");
		builder.append("    \"analysis\": { ");

View on GitHub (pinned to d5f144c24d)

Solutions

  1. Manually issue the PUT index/_settings request via curl and inspect the raw response body to determine what the server actually returned.
  2. Verify the Elasticsearch server version is compatible with this BSim client.
  3. Check authentication credentials — a 401 Unauthorized may produce a response without the acknowledged field.
  4. Remove any HTTP proxy or gateway that might alter or replace the response body.
Defensive patterns

Strategy: validation

Validate before calling

// Before adjusting settings, verify the server is reachable and responding normally
JsonObject health = connection.executeURIOnly(ElasticConnection.GET, "_cluster/health");
if (health == null || ElasticConnection.isNull(health.get("status"))) {
    throw new IllegalStateException("Elasticsearch server not responding normally");
}

Try / catch

try {
    database.query(adjustQuery);
} catch (ElasticException e) {
    if (e.getMessage().contains("Unknown response")) {
        // Server returned non-standard response — check version/auth/proxy
        Msg.error(this, "Settings update returned unexpected response: " + e.getMessage());
    }
    throw e;
}

Prevention

When it happens

Trigger: Called during database creation or during adjust/ingest-optimization commands that tune number_of_replicas and refresh_interval. The PUT _settings response is parsed and resp.get("acknowledged") returns null or a JsonNull.

Common situations: Incompatible Elasticsearch version that returns a different response shape; HTTP proxy returning an error page instead of JSON; authentication failure (401) whose body lacks the acknowledged field; network timeout producing a truncated or empty response body.

Related errors


AI-assisted analysis of NationalSecurityAgency/ghidra@d5f144c24d (2026-08-14). Data as JSON: /api/errors/7747fe6cf7433121. Report an issue: GitHub.