Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get an warning: ResponseError: too_long_frame_exception #1025

Closed
barwalker opened this issue Dec 17, 2019 · 5 comments
Closed

Get an warning: ResponseError: too_long_frame_exception #1025

barwalker opened this issue Dec 17, 2019 · 5 comments
Labels

Comments

@barwalker
Copy link

barwalker commented Dec 17, 2019

Hi all, I encountered with a "too_long_frame_exception" warning when using scroll to fetch data from Elastic.

Issue

Here is the query to get data in 1 month:

                "gte": "2019-11-17T17:00:00.000Z",
                "lte": "2019-12-17T17:00:00.000Z"
GET band-monitor-*/_search
{
    "query": {
      "bool": {
        "must": [
          {
            "bool": {
              "should": [
                {
                  "match": {
                    "band_id": 118217
                  }
                },
                {
                  "match": {
                    "band_id": 118220
                  }
                },
                {
                  "match": {
                    "band_id": 118221
                  }
                }
              ]
            }
          },
          {
            "range": {
              "createdDate": {
                "gte": "2019-11-17T17:00:00.000Z",
                "lte": "2019-12-17T17:00:00.000Z"
              }
            }
          }
        ],
        "filter": {
          "script": {
            "script": {
              "source": "return doc['scan_id'].value % 10 == 0"
            }
          }
        }
      }
    },
    "sort": [
      {
        "scan_id": {
          "order": "asc"
        }
      }
    ],
    "aggs": {},
    "size": 9999
}

Run in Kibana and It returns 13384 records. I think this amount is not big at all.
However when using npm @elastic/elasticsearch in nodejs, it shows an error:

{ ResponseError: too_long_frame_exception
    at IncomingMessage.response.on (/home/admin1/Documents/backend_v1/node_modules/@elastic/elasticsearch/lib/Transport.js:287:25)
    at IncomingMessage.emit (events.js:203:15)
    at IncomingMessage.EventEmitter.emit (domain.js:448:20)
    at endReadableNT (_stream_readable.js:1143:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  name: 'ResponseError',
  meta:
   { body: { error: [Object], status: 400 },
     statusCode: 400,
     headers:
      { 'content-type': 'application/json; charset=UTF-8',
        'content-length': '211' },
     warnings: null,
     meta:
      { context: null,
        request: [Object],
        name: 'elasticsearch-js',
        connection: [Object],
        attempts: 0,
        aborted: false } } }

With a smaller range, it works fine.
E.g:
"gte": "2019-11-17T17:00:00.000Z",
"lte": "2019-11-27T17:00:00.000Z"

Expected behaviour

Just 20k data, this package should be working probably. I even try to use scroll with scroll time: 30s, size: 100.
Please help to find any solution for this issue. Thank all.

Your Environment

Node version: 8.10
@elastic/elasticsearch version: ^7.5.0
OS: Ubuntu 16.04
ES cluster version: 6.8
@delvedor
Copy link
Member

Hello!
Can you paste here the javascript code that you are using to run the query?
ResponseError means that the error is happening on the Elaticsearch side.

Furthermore, you should use the same major version of Elasticsearch in the client, you can do that by running:

npm i @elastic/elasticsearch@6

@stale
Copy link

stale bot commented Jan 3, 2020

We understand that this might be important for you, but this issue has been automatically marked as stale because it has not had recent activity either from our end or yours.
It will be closed if no further activity occurs, please write a comment if you would like to keep this going.

Note: in the past months we have built a new client, that has just landed in master. If you want to open an issue or a pr for the legacy client, you should do that in https://github.com/elastic/elasticsearch-js-legacy

@stale stale bot added the stale label Jan 3, 2020
@stale stale bot closed this as completed Jan 10, 2020
@nelsou
Copy link

nelsou commented Jan 31, 2020

Hello @BernardIsibor
Did you fix your issue ? I'm having exactly the same problem.

too_long_frame_exception when scrolling (by 2.000) over my results (~1.000.000)

@elastic/elasticsearch version: ^6
ES cluster version: 6.5

Please let me know

@jdelriops
Copy link

jdelriops commented Feb 8, 2021

In my case, that error happened because the API was trying to set the scroll_id in the queryString as part of the URL, and that has limit.

I solved the problem changing from:

response = await client.scroll({
  scrollId: my_scroll_id,
  scroll: scroll_params
})

To:

response = await client.scroll({
  method: 'POST',
  body: {
    scroll_id: my_scroll_id,
    scroll: scroll_params
  }
})

That way you can prevent the API code to try to set the scroll_id in the queryString, using the POST body instead.

@lijianl
Copy link

lijianl commented Jun 10, 2021

In my case, that error happened because the API was trying to set the scroll_id in the queryString as part of the URL, and that has limit.

I solved the problem changing from:

response = await client.scroll({
  scrollId: my_scroll_id,
  scroll: scroll_params
})

To:

response = await client.scroll({
  method: 'POST',
  body: {
    scroll_id: my_scroll_id,
    scroll: scroll_params
  }
})

That way you can prevent the API code to try to set the scroll_id in the queryString, using the POST body instead.

In my case, that error happened because the API was trying to set the scroll_id in the queryString as part of the URL, and that has limit.

I solved the problem changing from:

response = await client.scroll({
  scrollId: my_scroll_id,
  scroll: scroll_params
})

To:

response = await client.scroll({
  method: 'POST',
  body: {
    scroll_id: my_scroll_id,
    scroll: scroll_params
  }
})

That way you can prevent the API code to try to set the scroll_id in the queryString, using the POST body instead.

very impressive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants