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

SearchAfter not working with nil #755

Open
jjauzion opened this issue Nov 16, 2023 · 0 comments
Open

SearchAfter not working with nil #755

jjauzion opened this issue Nov 16, 2023 · 0 comments

Comments

@jjauzion
Copy link

With the typeClient (v8) the SearchAfter takes a list of types.FieldValue where, according to the doc, a FieldValue is any of:

//	int64
//	Float64
//	string
//	bool
//	nil
//	json.RawMessage

So I would expect that a query with a nil value in the SearchAfter works the same as a query with no SearchAfter. But when I pass a nil value I get a 500 error:

"error": "status: 500, failed: [search_phase_execution_exception], reason: all shards failed"

Code example:

es, _ := elasticsearch.NewTypedClient(cfg)
res, err := es.Search().Index("myIndex").Request(&search.Request{
		Query: &types.Query{
			Match: map[string]types.MatchQuery{
				"field1": {Query: "value1"},
			},
		},
		Sort: types.Sort{types.SortOptions{
			SortOptions: map[string]types.FieldSort{
				"date": {
					Order: &sortorder.Desc,
				},
			},
		}},
		SearchAfter: []types.FieldValue{nil},
	}).Do(ctx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant