elasticsearch - Error using Object Initializer syntax to create MultiMatchQuery -
i'm using nest 2.2.0 , trying build multimatch query follows:
var searchquery = new multimatchquery() { fields = field<product>(p=>p.skuname, 2), query = "hello world" };
when run however, returns:
the non-generic type 'nest.field' cannot used type arguments.
i don't understand why i'm getting error, since i've more or less taken query straight documentation found @ https://www.elastic.co/guide/en/elasticsearch/client/net-api/2.x/multi-match-usage.html#_object_initializer_syntax_example_35.
in case matters, i've defined product follows:
[elasticsearchtype(name="product", idproperty="id")] public class product { [nest.number(store = true)] public int id {get;set;} [string(name="name", store = true, index=fieldindexoption.analyzed)] public string skuname { get; set; } }
is able help?
the field
type you're looking nest.infer.field
var searchquery = new multimatchquery() { fields = nest.infer.field<product>(p => p.skuname, 2), query = "hello world" }; client.search<product>(new searchrequest { query = searchquery });
Comments
Post a Comment