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

Stack overflow when using a pinned query #4733

Closed
DavidRouyer opened this issue Jun 3, 2020 · 3 comments · Fixed by #4741
Closed

Stack overflow when using a pinned query #4733

DavidRouyer opened this issue Jun 3, 2020 · 3 comments · Fixed by #4741

Comments

@DavidRouyer
Copy link

NEST/Elasticsearch.Net version: 7.7.1

Elasticsearch version: 7.7.0

Description of the problem including expected versus actual behavior:
I'm trying to make a pinned query with NEST but I'm getting a brutal Stack overflow. message

Steps to reproduce:

  1. Try to make a simple pinned query:
ElasticClient.SearchAsync<CreatorNewIndex>(
    new SearchDescriptor<CreatorNewIndex>()
            .From(0)
            .Size(25)
            .Source(s => s.Excludes(e => e.Field(f => f.Events)))
            .Query(q => q.Pinned(p => p
                .Organic(o => o.MatchAll())
                .Ids(new[] { "387c2c78-95b1-42f8-a965-e09a73f7cff6" }))))

or

       var body = PostData.Serializable(new SearchDescriptor<CreatorNewIndex>()
            .From(0)
            .Size(25)
            .Source(s => s.Excludes(e => e.Field(f => f.Events)))
            .Query(q => q.Pinned(p => p
                .Organic(o => o.MatchAll())
                .Ids(new[] { "387c2c78-95b1-42f8-a965-e09a73f7cff6" }))));

            return ElasticClient.LowLevel.SearchAsync<BytesResponse>(this.IndexName, body, ctx: cancellationToken);

which is the equivalent of (but this works)

{
    "query": {
        "pinned": {
            "ids": ["387c2c78-95b1-42f8-a965-e09a73f7cff6"],
            "organic": {
            	"match_all": {}
            }
        }
    },
    "from": 0,
    "size": 25,
    "_source": {
        "excludes": [
            "events"
        ]
    }
}
  1. NEST crashes with a Stack overflow. message

Expected behavior
NEST should return the response from Elasticsearch

Provide ConnectionSettings (if relevant):

Provide DebugInformation (if relevant):
I don't have any debug information, I can't catch the error and I only have a 'Stack overflow.' message printed in the console before my program abruptly stops.

@DavidRouyer DavidRouyer added the Bug label Jun 3, 2020
@russcam
Copy link
Contributor

russcam commented Jun 5, 2020

Thanks for opening @DavidRouyer. This is a bug in the Ids() overloads which we'll fix for the next release. In the meantime, you can use

client.Search<object>(s => s
		.From(0)
		.Size(25)
		.Source(s => s.Excludes(e => e.Field("events")))
		.Query(q => q.Pinned(p => p
			.Organic(o => o.MatchAll())
			.Ids("387c2c78-95b1-42f8-a965-e09a73f7cff6")
		)
	)
);

or

client.Search<object>(s => s
		.From(0)
		.Size(25)
		.Source(s => s.Excludes(e => e.Field("events")))
		.Query(q => q.Pinned(p => p
			.Organic(o => o.MatchAll())
			.Ids(new Id[] { "387c2c78-95b1-42f8-a965-e09a73f7cff6" })
		)
	)
);

russcam added a commit that referenced this issue Jun 5, 2020
This commit fixes the Ids overloads on PinnedQuery by
performing the conversion to IEnumerable<Id> on each
overload and assigning to the Ids value.

Fixes #4733
@russcam
Copy link
Contributor

russcam commented Jun 5, 2020

opened #4741 to address

@russcam russcam added the v7.8.0 label Jun 5, 2020
@DavidRouyer
Copy link
Author

Thank you! I'll do that

russcam added a commit that referenced this issue Jun 10, 2020
This commit fixes the Ids overloads on PinnedQuery by
performing the conversion to IEnumerable<Id> on each
overload and assigning to the Ids value.

Fixes #4733
github-actions bot pushed a commit that referenced this issue Jun 10, 2020
This commit fixes the Ids overloads on PinnedQuery by
performing the conversion to IEnumerable<Id> on each
overload and assigning to the Ids value.

Fixes #4733
github-actions bot pushed a commit that referenced this issue Jun 10, 2020
This commit fixes the Ids overloads on PinnedQuery by
performing the conversion to IEnumerable<Id> on each
overload and assigning to the Ids value.

Fixes #4733
russcam added a commit that referenced this issue Jun 10, 2020
This commit fixes the Ids overloads on PinnedQuery by
performing the conversion to IEnumerable<Id> on each
overload and assigning to the Ids value.

Fixes #4733

Co-authored-by: Russ Cam <russ.cam@elastic.co>
russcam added a commit that referenced this issue Jun 10, 2020
This commit fixes the Ids overloads on PinnedQuery by
performing the conversion to IEnumerable<Id> on each
overload and assigning to the Ids value.

Fixes #4733

Co-authored-by: Russ Cam <russ.cam@elastic.co>
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

Successfully merging a pull request may close this issue.

2 participants