Добрый день:
У меня проблема с моим POCO при поиске NEST. В настоящее время я могу искать свой документ, который сериализован в мой POCO, однако мое свойство id имеет значение null:
IMultiSearchResponse responses = await this._elasticClient.MultiSearchAsync(ms => ms.Search<Facility>("FacilityWithReviews",s =>
s.Query(q => q.Nested(n => n.Path(p => p.Reviews)
.Query(nq => nq.Term(t => t.Field(f=>f.Reviews.First().Id).Value(review.Id.ToString())))))
)
.Search<Facility>("FacilityWithoutReviews", s => s.Query(q =>
q.Ids(c => c.Values(facilityId)))));
Итак, мой FacilityWithoutReviews
установлен:
var facilityWithOutReviews = responses.GetResponse<Facility>("FacilityWithoutReviews");
Это мой POCO:
[ElasticsearchType(Name="facility", IdProperty ="Id")]
public class Facility
{
public string Id { get; set; }
Это мой запрос ElasticSearch и ответ, чтобы получить Средство
Successful low level call on POST: /_msearch?typed_keys=true
# Audit trail of this API call:
- [1] HealthyResponse: Node: http://localhost:9200/ Took: 00:00:00.2014849
# Request:
{"index":"dev","type":"doc"}
{"query":{"nested":{"query":{"term":{"reviews.id":{"value":"00000000-0000-0000-0000-000000000000"}}},"path":"reviews"}}}
{"index":"dev","type":"doc"}
{"query":{"ids":{"values":["s5NjYWQBRsDWVSSXM-W0"]}}}
# Response:
{"responses":[{"took":27,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]},"status":200},{"took":23,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":1.0,"hits":[{"_index":"dev","_type":"doc","_id":"s5NjYWQBRsDWVSSXM-W0","_score":1.0,"_source":{"name":"facility 3","types":[1],"status":1,"registrationDate":"0001-01-01T00:00:00","capacity":0,"rating":0.0,"licenseStatus":0,"licenseDate":"0001-01-01T00:00:00","licenseCloseDate":"0001-01-01T00:00:00","address":"7 thomas avenue*","zipCode":"12345","rentLow":0.0,"rentHigh":0.0,"basePriceLow":0.0,"basePriceHigh":0.0,"oneTimeFee":0.0,"levelOfCareRangeMinimum":0.0,"levelOfCareRangeMaximum":0.0,"city":"new york city","state":"New York","facilityManagements":[{"userId":"7c7f50b3-1d9d-48d0-8e86-352a84f0840b","operations":1,"isOwner":true,"isActive":true,"createdDate":"2018-07-03T18:24:07.9175473Z","id":"5af82e77-707d-49b8-be35-b570962557c0"}],"facilityRequests":[{"userId":"7c7f50b3-1d9d-48d0-8e86-352a84f0840b","createdDate":"2018-07-03T18:24:07.9175473Z","status":1,"id":"7538a645-0776-4799-83c4-c6a8459bf4c5"}],"slug":"facility-3-7-thomas-avenue","approved":false,"businessLocation":{"lat":40.7143548,"lon":-74.0059738},"suggest":{"input":["new york city","New York","facility","3"]}}}]},"status":200}]}