在 NEST 5.0.0-rc1 上查询时发送空请求
Empty request sent when querying on NEST 5.0.0-rc1
问题基本上是无论我正在构建哪个查询,它都不会发送到 elasticsearch。
例如这个:
_elasticClient.SearchAsync<CostSearch>(d =>
d.Query(q =>
q.Match(f => f.Field(c => c.AgencyTrackingNo == costQuery.Query))
)
);
发送的请求是一个空对象,这意味着我正在从该索引和类型中获取所有值。
您可以在以下日志中查看:
[11:47:36 INF] POST http://localhost:9200/costs/costsearch/_search
要求:
{}
状态:200
{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hit
s":{"total":1,"max_score":1.0,"hits":[{"_index":"costs","_type":"costsearch","_i
d":"1","_score":1.0,"_source":{
"id": "-0897-98df7-df8-96",
"title": "Test cost",
"budget": 12323.34,
"contentType": "Photo",
"agencyTrackingNo": "GL036001V",
"agencyProducer": "Grey, New York",
"costOwner": "John Doe guid",
"stage": "Draft",
"approvalStatus": "ToBeApproved",
"ioNumber": "IO123854B",
"initiative": "Gillete 2016",
"budgetRegion": "Japan",
"country": "countryid",
"city": "cityid",
"userGroups": ["1987", "1986"]
}
}]}
糟糕,原来我误用了字段选择器。
_elasticClient.SearchAsync<CostSearch>(d =>
d.Query(q =>
q.Match(f => f.Field(c => c.AgencyTrackingNo).Query(costQuery.Query))
)
);
问题基本上是无论我正在构建哪个查询,它都不会发送到 elasticsearch。 例如这个:
_elasticClient.SearchAsync<CostSearch>(d =>
d.Query(q =>
q.Match(f => f.Field(c => c.AgencyTrackingNo == costQuery.Query))
)
);
发送的请求是一个空对象,这意味着我正在从该索引和类型中获取所有值。 您可以在以下日志中查看:
[11:47:36 INF] POST http://localhost:9200/costs/costsearch/_search 要求: {} 状态:200
{"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"failed":0},"hit
s":{"total":1,"max_score":1.0,"hits":[{"_index":"costs","_type":"costsearch","_i
d":"1","_score":1.0,"_source":{
"id": "-0897-98df7-df8-96",
"title": "Test cost",
"budget": 12323.34,
"contentType": "Photo",
"agencyTrackingNo": "GL036001V",
"agencyProducer": "Grey, New York",
"costOwner": "John Doe guid",
"stage": "Draft",
"approvalStatus": "ToBeApproved",
"ioNumber": "IO123854B",
"initiative": "Gillete 2016",
"budgetRegion": "Japan",
"country": "countryid",
"city": "cityid",
"userGroups": ["1987", "1986"]
}
}]}
糟糕,原来我误用了字段选择器。
_elasticClient.SearchAsync<CostSearch>(d =>
d.Query(q =>
q.Match(f => f.Field(c => c.AgencyTrackingNo).Query(costQuery.Query))
)
);