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

The msearch request must be terminated by a newline [\n] #2212

Closed
jorgeju4rez opened this issue Apr 25, 2023 · 1 comment
Closed

The msearch request must be terminated by a newline [\n] #2212

jorgeju4rez opened this issue Apr 25, 2023 · 1 comment
Labels

Comments

@jorgeju4rez
Copy link

Affected Projects: React

Library Version: 4.0.0-rc.10

Describe the bug

I am migrating from version 3.43.6 to 4.0.0-rc.10 and it is giving me an unusual error

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "The msearch request must be terminated by a newline [\n]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "The msearch request must be terminated by a newline [\n]"
    },
    "status": 400
}

To Reproduce

import React from "react";
import { ReactiveBase, SearchBox } from "@appbaseio/reactivesearch";

function List() {
  return (
    <ReactiveBase
      url="https://my-elastic.com"
      app="products"
      credentials="aaa:bbb"
      transformRequest={(props) => ({
        ...props,
        url: props.url.replace("_reactivesearch", "_msearch")
      })}
    >
      <SearchBox
        componentId="searchbox"
        dataField={[
          {
            field: "products.code.keyword",
            weight: 20
          }
        ]}
        placeholder="Search for books or authors"
      />
    </ReactiveBase>
  );
}

export default List;
@siddharthlatest
Copy link
Member

@jorgeju4rez While you're replacing the _reactivesearch part in the URL, the body is still for the ReactiveSearch API. Basically, starting v4, it's required for you to use the ReactiveSearch API service (cloud or self-hosted) to connect to Elasticsearch instead of making a direct _msearch call.

See the discussion here for context: #2197

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

2 participants