c# - Elasticsearch.net client can't do basic search -
I have a basic elastic search query that looks like this
POST / fruit / _search {"query": {"word": {"name": "banana"}}}
I have found the result, no problem when I understand
So I try to do it in elasticsearch.net
var requestBody = new {query = new {term = new} {name = "banana"}} }; Var Results = Client Search & lt; String & gt; ("Fruit", requestBody);
And I did not get any results. If I have a new {} new search body, I get hit, but not filtered.
What am I doing?
Var query = new {query = new {term = new} {name = "banana"}} var json = for new elastic search (). Serializer.Serialize (query) .Utf8String ();
This will be the result of the following json:
{"query": {"term": {"name": "banana"}}}
If you use Nest, the default behavior is for camel entering the property names (Nest's opinion):
{"query": {"term": {"name": "banana"}}}
If you use a low-level customer through a high level client ( client.Raw
), then this same exact setting as the exact high-level client.
You This behavior can be controlled by a high-level client through:
var connectionSettings = new connection settings () .SetDefaultPropertyNameInferrer (p = & gt; P); Var client = new elastic client (connection settings);
Comments
Post a Comment