-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Bug Span near query: "Less than 2 subSpans.size():1" #25630
Comments
I cannot reproduce the difference between GET/POST you report. I also get the failure you are seeing, I think this might be an error in the documentation for the span near query. My understanding from reading the SpanNearQuery Lucene is that it always requires at least two clauses. Maybe @jpountz or @jimczi can confirm this? In this case we should update the documentation and maybe throw an error earlier in the Elasticsearch query builder if we only have one clause. |
I think it should be handled automatically in ES. I fixed the auto-generated case where another query creates a SpanNearQuery with a single clause but I did not change the SpanNearQueryBuilder itself. |
Ok, my bad. My test client (Paw) didn't actually sent the request body. Just using curl (as I added as an example, doh) does show that it fails regardless whether it is Sorry for the confusion. |
…use is provided This change handles the case where a SpanNearQueryBuilder tries to create a query with a single clause. This is not allowed in the SpanNearQuery so instead of throwing an exception when the weight is built, this change builds and returns the singleton inner clause on toQuery. Fixes elastic#25630
…use is provided (#25856) This change handles the case where a SpanNearQueryBuilder tries to create a query with a single clause. This is not allowed in the SpanNearQuery so instead of throwing an exception when the weight is built, this change builds and returns the singleton inner clause on toQuery. Fixes #25630
…use is provided (#25856) This change handles the case where a SpanNearQueryBuilder tries to create a query with a single clause. This is not allowed in the SpanNearQuery so instead of throwing an exception when the weight is built, this change builds and returns the singleton inner clause on toQuery. Fixes #25630
Elasticsearch version: 5.5.0 (docker.elastic.co/elasticsearch/elasticsearch:5.5.0)
Description:
The documentation for the span near query states:
(emphasis mine)
Just supplying one clause though, causes an error to be returned
iff the HTTP request method is. E.g.POST
instead ofGET
Steps to reproduce:
With ES 5.5.0 running:
If using an HTTPthis fails with:POST
The same request using aGET
request method succeeds.According to https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html it should be possible to use eitherPOST
orGET
.GET
vs.POST
was just a red herring. This fails in either case.The text was updated successfully, but these errors were encountered: