Skip to content

version 0.12: multi search with .Type("product") failes with null reference exception #523

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

Closed
ThomasSkyldahl opened this issue Mar 5, 2014 · 1 comment

Comments

@ThomasSkyldahl
Copy link

ConcreteTypeConverter.GetConcreteTypeUsingSelector can return null for type if the as the typeDict can contain null values for the type and that case isn't handled.

I think it would make sense to check if the type is null otherwise return the baseType

Here is the the required code to reproduce the issue:

the search document class:

// indexed type
public class Product
{
  public string Code { get; set; }
}

public class MultiSearchThrowsWhenTypeIsSpecified
{       
 static void Main(string[] args)
        {
            var nest = new ElasticClient(new ConnectionSettings(new Uri("http://localhost:9200")));
            var indexName = "multisearch-with-type-name-error";
            var typeName = "product";
            nest.IndexMany(
                new[] {
                    new Product { Code = "1234" }, 
                    new Product { Code = "5678" }
                },
                indexName, typeName, new SimpleBulkParameters { Refresh = true });

            var searchName = "products";

            var result = nest.MultiSearch(descriptor => descriptor.Search<Product>(searchName,
                b => b.Index(indexName)
// I think the issue is that the type name is specified
                    .Type(typeName)));

            result.GetResponse<Product>(searchName);
        }
}
@Mpdreamz
Copy link
Member

Sorry for taking so long to respond to this issue, I take pride in responding to issues ASAP but dropped the ball here.

Thanks for reporting @ThomasSkyldahl !

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

2 participants