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

IMultisearchResponse's ConnectionStatus.Request is null #1201

Closed
philbarresi opened this issue Jan 14, 2015 · 4 comments
Closed

IMultisearchResponse's ConnectionStatus.Request is null #1201

philbarresi opened this issue Jan 14, 2015 · 4 comments

Comments

@philbarresi
Copy link
Contributor

I am trying to log the requests I am making to better debug some internal issues, and apparently after performing an var results = await _client.MultiSearchAsync(...), sometimes results.ConnectionStatus.Request comes back as null. I am attempting to get the JSON request that hits the server; if there's a better way to do that, I would love to know.

@Mpdreamz
Copy link
Member

Hi @xueye this is definitely a bug.

I have a hard time reproducing it can you share a little bit more of the code that you have in place?

How does _client get constructed (what settings? connectionpooling? different connection?)

@philbarresi
Copy link
Contributor Author

Hi there! It's very hard to reproduce; my theory is that this happens when there would be an XContent exception thrown.

This function generates the settings we use.

            public static ConnectionSettings BuildSettings(params Uri[] uris)
            {
            var pool = new SniffingConnectionPool(uris, randomizeOnStartup: true);

            var settings = new ConnectionSettings(pool);
            settings.SniffOnStartup(true)
                .SniffLifeSpan(TimeSpan.FromSeconds(5));
            settings.SetPingTimeout(1000);
            settings.MaximumRetries(10);

            settings.MapDefaultTypeNames(x => x.Add(typeof(CompanyProfile), CompanyProfileType)
                .Add(typeof(PersonProfile), PersonProfileType)
                .Add(typeof(FeedItem), FeedType));

            settings.MapDefaultTypeIndices(x => x.Add(typeof(CompanyProfile), CompanyIndex)
                .Add(typeof(PersonProfile), PeopleIndexName));

            settings.DisableAutomaticProxyDetection(false);

            settings.SetJsonSerializerSettingsModifier(serializer =>
            {
                var mappings = new FluentMappings(wrappedResolver: serializer.ContractResolver);
                mappings.MapClass<CompanyProfile>(cm =>
                {
                    cm.MapMember(x => x.Domains, x => x.SetConverter(new WheeConverter()));
                });

                mappings.MapClass<InvestmentEntry>(cm =>
                {
                    cm.SetDiscriminator("InvestmentEntry");
                });

                mappings.MapClass<CorporateInvestmentEntry>(cm =>
                {
                    cm.SetDiscriminator("CorporateInvestmentEntry");
                });

                mappings.MapClass<IndividualInvestmentEntry>(cm =>
                {
                    cm.SetDiscriminator("IndividualInvestmentEntry");
                });

                serializer.ContractResolver = mappings.ContractResolver;
                serializer.Binder = mappings.Binder;

                serializer.Converters = serializer.Converters ?? new List<JsonConverter>();
                serializer.Converters.Add(new StringEnumConverter());
                serializer.Converters.Add(new StringProviderIdentifierConverter());
                serializer.Converters.Add(new LanguageInfoConverter());
            });

            settings.SetTimeout((int)TimeSpan.FromSeconds(60).TotalMilliseconds);

            return settings;
            }

@philbarresi
Copy link
Contributor Author

This is happening a few times every day, and I managed to get a bit more info. This happens whenever there is a Failed to derive xcontent from org.elasticsearch.common.bytes.BytesArray@1 issue (which is what I was originally trying to debug). Is there any other way to get a string of the JSON request before I actually await the call so I can try and see what's causing the xcontent issue?

@Mpdreamz Mpdreamz added v1.5.1 and removed v1.5.0 labels May 7, 2015
@gmarz gmarz added v1.5.2 and removed v1.5.1 labels May 29, 2015
@gmarz gmarz added v1.6.1 and removed v1.5.2 labels Jun 19, 2015
@Mpdreamz
Copy link
Member

@xueye I have not been able to reproduce this, will close this for now but please report back if you still seeing this issue!

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

3 participants