-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
NEST/Elasticsearch.Net version_: 1.7.2
_Elasticsearch version*: 1.7.5
Description of the problem including expected versus actual behavior:
This code
return new FunctionScoreFunction<GroupListSearchDataContract>()
.Weight(weight)
.Filter(fi => fi
.Bool(b => b
.Should(
s => s.Range(r => r.OnField(f => f.RoleCriteria.TargetMoveIn)
.GreaterOrEquals(earliestDate)
.LowerOrEquals(farthestDate)
.Format("yyyy-MM-dd'T'HH:mm:ss.SSS"))
)));
Produces this json
{
"filter": {
"bool": {
"should": [
{
"range": {
"roleCriteria.targetMoveIn": {
"lte": "2016-09-02T00:00:00.000",
"gte": "2016-07-02T00:00:00.000"
}
}
}
]
}
},
"weight": 1
}
The mapping for the date field is
.Date(d => d.Name(n => n.TargetMoveIn).Format("yyyy-MM-dd'T'HH:mm:ss"))
Notice there is no "format" property in the json produced and therefore ES throws an exception. If I manually added the format and directly query ES it works fine.
Let me know if you need more information.
FYI My workaround is this
return new FunctionScoreFunction<GroupListSearchDataContract>()
.Weight(weight)
.Filter(fi => fi
.Bool(b => b
.Should(
s => s.Range(r => r.OnField(f => f.RoleCriteria.TargetMoveIn)
.GreaterOrEquals(earliestDate, "yyyy-MM-dd'T'HH:mm:ss")
.LowerOrEquals(farthestDate, "yyyy-MM-dd'T'HH:mm:ss")
)
)));
Metadata
Metadata
Assignees
Labels
No labels