{"record":{"id":"7747fe6cf7433121","repo":"NationalSecurityAgency/ghidra","slug":"unknown-response-trying-to-adjust-number-of-replic","errorCode":null,"errorMessage":"Unknown response trying to adjust number_of_replicas and refresh_interval","messagePattern":"Unknown response trying to adjust number_of_replicas and refresh_interval","errorType":"exception","errorClass":"ElasticException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":1939,"sourceCode":"\t */\n\tprivate void adjustReplicaRefresh(String index, int numReplicas, int refreshRateInSecs)\n\t\t\tthrows ElasticException {\n\t\tStringBuilder builder = new StringBuilder();\n\t\tbuilder.append(\"{ \\\"index\\\": { \");\n\t\tbuilder.append(\"  \\\"number_of_replicas\\\": \").append(numReplicas).append(\", \");\n\t\tbuilder.append(\"  \\\"refresh_interval\\\": \\\"\");\n\t\tif (refreshRateInSecs < 1) {\n\t\t\tbuilder.append(\"-1\");\t\t// Indicates that no refreshes are scheduled\n\t\t}\n\t\telse {\n\t\t\tbuilder.append(refreshRateInSecs).append('s');\n\t\t}\n\t\tbuilder.append(\"\\\" } }\");\n\t\tJsonObject resp = connection.executeStatement(ElasticConnection.PUT, index + \"/_settings\",\n\t\t\tbuilder.toString());\n\t\tJsonElement ack = resp.get(\"acknowledged\");\n\t\tif (ElasticConnection.isNull(ack)) {\n\t\t\tthrow new ElasticException(\n\t\t\t\t\"Unknown response trying to adjust number_of_replicas and refresh_interval\");\n\t\t}\n\t\tif (!ack.getAsBoolean()) {\n\t\t\tthrow new ElasticException(\"Cluster did not accept settings for index: \" + index);\n\t\t}\n\t}\n\n\t/**\n\t * This routine establishes the schema for the \"vector\" and \"meta\" document types\n\t * for a new database. It also sets up weights and hashes for the vector tokenizer (lsh_tokenizer).\n\t * @param config contains database configuration info\n\t * @throws ElasticException for communication problems with the server\n\t */\n\tprivate void createVectorIndex(Configuration config) throws ElasticException {\n\t\tStringBuilder builder = new StringBuilder();\n\t\tbuilder.append(\"{ \\\"settings\\\": { \");\n\t\tbuilder.append(\"  \\\"index\\\": { \");\n\t\tbuilder.append(\"    \\\"analysis\\\": { \");","sourceCodeStart":1921,"sourceCodeEnd":1957,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L1921-L1957","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Manually issue the PUT index/_settings request via curl and inspect the raw response body to determine what the server actually returned.","Verify the Elasticsearch server version is compatible with this BSim client.","Check authentication credentials — a 401 Unauthorized may produce a response without the acknowledged field.","Remove any HTTP proxy or gateway that might alter or replace the response body."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before adjusting settings, verify the server is reachable and responding normally\nJsonObject health = connection.executeURIOnly(ElasticConnection.GET, \"_cluster/health\");\nif (health == null || ElasticConnection.isNull(health.get(\"status\"))) {\n    throw new IllegalStateException(\"Elasticsearch server not responding normally\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    database.query(adjustQuery);\n} catch (ElasticException e) {\n    if (e.getMessage().contains(\"Unknown response\")) {\n        // Server returned non-standard response — check version/auth/proxy\n        Msg.error(this, \"Settings update returned unexpected response: \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Verify Elasticsearch version compatibility before issuing settings commands.","Ensure authentication credentials are valid — a 401 may produce a non-standard response.","Bypass HTTP proxies that might modify response bodies for Elasticsearch traffic."],"tags":["elasticsearch","bsim","settings","configuration","response-parsing","acknowledged"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}