我试图在elasticsearch中建立一个索引,然后搜索数字字段。结果集是空的,即使你的逻辑结果是有一个记录结果集。Elasticsearch中的数字范围/过滤器
下面的操作来再现(使用感)
创建索引
PUT playground
创建
POST playground/doc
{
"value": {
"textlabel": "Lorem Ipsum",
"numerlabel": 37.0,
"datelabel":"1978-10-26T00:00:00+02:00"
}
}
自动生成的映射文件似乎提供了一个文件正确的数据类型
{
"playground": {
"mappings": {
"doc": {
"properties": {
"value": {
"properties": {
"datelabel": {
"type": "date",
"format": "dateOptionalTime"
},
"numerlabel": {
"type": "double"
},
"textlabel": {
"type": "string"
}
}
}
}
}
}
}
}
上的日期范围搜索工作正常,返回预期数据
POST playground/doc/_search
{
"query": {
"filtered": {
"filter": {
"range" : {
"value.datelabel" : {
"lte": "now-28y"
}
}
}
}
}
}
但数值范围不
返回任何结果POST playground/doc/_search
{
"query": {
"filtered": {
"filter": {
"range": {
"value.numberlabel" : {
"lte": 100
}
}
}
}
}
}
结果
{ "took": 1, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 0, "max_score": null, "hits": [] } }
任何建议为什么?
谢谢安德烈 - 我检查了100次查询的拼写......但没有看文档的创建。非常感谢! –