Comments (4)
Depending on how many concurrent open connections your code is making to Elasticsearch, and how your Elasticsearch instance's networking is configured, this is more likely a networking error when connecting with Elasticsearch than a bug in the client code itself.
If you intend to index thousands of documents at once, you can do it much more efficiently the bulk API or the bulk API helper, which lets you index many documents per request rather than one request per document, lowering the networking overhead significantly.
It looks like you tested this in multiple versions of Node.js, but I did also want to point out that there was a bug in Node 20.0.0 that caused a socket connection timeout error, which was patched in 20.3.0.
I'm going to close this for now. Feel free to reopen with more details if your problem persists.
from elasticsearch-js.
it also throws like this
ConnectionError: Socket connection timeout
at SniffingTransport.request (/usr/src/app/node_modules/@elastic/transport/lib/Transport.js:528:31)
from elasticsearch-js.
we are at node 20.2.0
how many concurrent inserts are a problem? 1k? 10k?
can I use something like a pool? like this
from elasticsearch-js.
The HTTP Agent
in @elastic/transport
has keepAlive
enabled by default, so existing connections can be reused. If you want to create and manage your own connection pool, the docs have several examples for how to do so.
As for how many concurrent inserts are a problem, it depends on how your Elasticsearch instance is configured and what resources are available to it. High amounts of concurrent requests are bound to available CPU threads. High indexing pressure can use a lot of memory, too, but is dependent on how indexing_pressure.memory.limit
is configured and defaults to 10% of available heap.
In your particular case, I'm also noticing that you have configured requestTimeout
to 3 seconds, where the default is 30 seconds. This could also lead to the RequestAbortedError
you're experiencing, if Elasticsearch is unable to respond in under 3 seconds. Try removing that setting to see what impact it has.
from elasticsearch-js.
Related Issues (20)
- Support Cloudflare Workers / Vercel Edge Functions HOT 3
- The query attribute on the `EnrichPolicy` should be `QueryDslQueryContainer | QueryDslQueryContainer[]` not `string` HOT 3
- Bulk helper not giving indications on failure when using stream as datasource HOT 1
- Number of open connections spikes when retryable errors occur HOT 7
- Deno: Module '"npm:@elastic/elasticsearch"' has no exported member 'CatIndicesIndicesRecord'. HOT 1
- Internal module error HOT 1
- bulk helper add onSuccess callback HOT 3
- Content-Type header being changed to "text/plain" from "application/json" somewhere in the process of publishing a document to self-hosted Elasticsearch HOT 5
- Global client context not passed to Transport in 7.13.0 HOT 1
- Support for ES|QL HOT 2
- enum and/or type guard for QueryDslTextQueryType HOT 1
- search_after with sort on nested fields HOT 1
- Redaction mechanism transform arrays properties into objects HOT 1
- Nuxt 3 compatibility HOT 2
- Using the `[]` chars for an enrich policy name isn't wrapped correctly on `deletePolicy` method HOT 1
- ProductNotSupportedError: The client noticed that the server is not a supported distribution of Elasticsearch HOT 1
- Add types for plugins HOT 2
- Error parsing undici module in Next.js 14 project HOT 3
- MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 product-check listeners added HOT 3
- test issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elasticsearch-js.