Skip to content

Instantly share code, notes, and snippets.

@Crell
Last active August 3, 2020 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Crell/73e113e293797d13fbb0c3e60bc2dc2f to your computer and use it in GitHub Desktop.
Save Crell/73e113e293797d13fbb0c3e60bc2dc2f to your computer and use it in GitHub Desktop.
FetchError: request to http://solr.internal:8080/solr/maincore/update? failed, reason: connect ECONNREFUSED 169.254.143.220:8080
at ClientRequest.<anonymous> (/app/node_modules/node-fetch/lib/index.js:1455:11)
at ClientRequest.emit (events.js:314:20)
at Socket.socketErrorListener (_http_client.js:469:9)
at Socket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:100:8)
at emitErrorCloseNT (internal/streams/destroy.js:68:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
type: 'system',
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED'
}
const solr = require('solr-node');
const config = require("platformsh-config").config();
exports.usageExample = async function() {
client = new solr({host: 'solr.internal', port: 8080, core: 'maincore', protocol: 'http'});
let output = '';
// Add a document.
let addResult = await client.update({
id: 123,
name: 'Valentina Tereshkova',
});
output += "Adding one document. Status (0 is success): " + addResult.responseHeader.status + "<br />\n";
// Flush writes so that we can query against them.
await client.softCommit();
// Select one document:
let strQuery = client.query().q();
let writeResult = await client.search(strQuery);
output += "Selecting documents (1 expected): " + writeResult.response.numFound + "<br />\n";
// Delete one document.
let deleteResult = await client.delete({id: 123});
output += "Deleting one document. Status (0 is success): " + deleteResult.responseHeader.status + "<br />\n";
return output;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment