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

msearch does not support an empty first line #39841

Closed
wants to merge 1 commit into from

Conversation

dadoonet
Copy link
Member

@dadoonet dadoonet commented Mar 8, 2019

In documentation we are saying that _msearch can use empty headers:

Note, the above includes an example of an empty header (can also be just without any content) which is supported as well.

This is true but not for the very first line of the request.

See this example:

DELETE /test
PUT /test/_doc/1
{
  "foo": "bar"
}

Running:

$ cat requests
{}
{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}
curl -H "Content-Type: application/x-ndjson" -XGET "http://127.0.0.1:9200/test/_msearch?pretty" --data-binary "@requests"; echo

Works well.

But running with:

$ cat requests

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

Gives:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "parsing_exception",
        "reason" : "Expected [START_OBJECT] but found [null]",
        "line" : 1,
        "col" : 0
      }
    ],
    "type" : "parsing_exception",
    "reason" : "Expected [START_OBJECT] but found [null]",
    "line" : 1,
    "col" : 0
  },
  "status" : 400
}

Related discussion: https://discuss.elastic.co/t/sending-multiple-count-requests-in-one-go/171456/14

In documentation we are saying that `_msearch` can use empty headers such as:

```
{}
{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}
```

This is true but not for the very first line of the request.

See this example:

```
DELETE /test
PUT /test/_doc/1
{
  "foo": "bar"
}
```

Running:


```
$ cat requests
```

```
{}
{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}
```

```
curl -H "Content-Type: application/x-ndjson" -XGET "http://127.0.0.1:9200/test/_msearch?pretty" --data-binary "@requests"; echo
```

Works well.

But running with:

```
$ cat requests
```

```

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}

{ "query": {"match_all": {}}}
```

Gives:

```json
{
  "error" : {
    "root_cause" : [
      {
        "type" : "parsing_exception",
        "reason" : "Expected [START_OBJECT] but found [null]",
        "line" : 1,
        "col" : 0
      }
    ],
    "type" : "parsing_exception",
    "reason" : "Expected [START_OBJECT] but found [null]",
    "line" : 1,
    "col" : 0
  },
  "status" : 400
}
```

Related discussion: https://discuss.elastic.co/t/sending-multiple-count-requests-in-one-go/171456/14
@dadoonet dadoonet added >docs General docs changes :Search/Search Search-related issues that do not fall into other categories labels Mar 8, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search

javanna added a commit to javanna/elasticsearch that referenced this pull request Apr 9, 2019
@javanna
Copy link
Member

javanna commented Apr 9, 2019

I consider this a bug, I don't like that we need to amend the docs by saying "we allow this, but not on the first line". I tried to address this in #41011 , though there is a downside, see the PR to know more ;)

@javanna
Copy link
Member

javanna commented Apr 23, 2019

Closing this in favour of #41011

@javanna javanna closed this Apr 23, 2019
javanna added a commit that referenced this pull request May 1, 2019
With #41442 we have deprecated support for empty line before any action metadata in msearch API. With this commit we remove support for such empty line, in place of parsing it as empty action metadata, which was previously not supported although the following items could have an empty line representing their corresponding action metadata. This way we make all times equal.

Relates to #39841
akhil10x5 pushed a commit to akhil10x5/elasticsearch that referenced this pull request May 2, 2019
With elastic#41442 we have deprecated support for empty line before any action metadata in msearch API. With this commit we remove support for such empty line, in place of parsing it as empty action metadata, which was previously not supported although the following items could have an empty line representing their corresponding action metadata. This way we make all times equal.

Relates to elastic#39841
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this pull request May 27, 2019
With elastic#41442 we have deprecated support for empty line before any action metadata in msearch API. With this commit we remove support for such empty line, in place of parsing it as empty action metadata, which was previously not supported although the following items could have an empty line representing their corresponding action metadata. This way we make all times equal.

Relates to elastic#39841
@colings86 colings86 deleted the doc/msearch-empty-first-line branch May 27, 2020 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>docs General docs changes :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants