带有ElasticSearch的NodeJS-不断获取[query_parsing_exception] [范围]查询不支持[天] [英] NodeJS with ElasticSearch - keep getting [query_parsing_exception] [range] query does not support [day]
问题描述
我正在尝试在nodeJS和我的ElasticSearch中运行一个简单的查询:
I am trying to run a simple query in nodeJS vs my ElasticSearch:
client.search({
index: "usage_*",
size : 100,
from: 0,
body: {
query: {
filtered:{
filter:{
bool:{
must: [{"range":{"created":{"gte":{"day":"09","month":"08","year":"2017"},"lt":"now"}}}]
}
}
}
}
}
}
而且我不断遇到以下异常:
and I keep getting an exception with:
[query_parsing_exception] [range]查询不支持[day],带有{index ="usage_2017-04-01"&第1行&col = 83}(和)[query_parsing_exception] [range]查询不支持[day],带有{index ="usage_2017-04-02"&第1行&col = 83}(和)[query_parsing_exception] [range]查询不支持[day],带有{index ="usage_2017-04-03"&第1行&col = 83}(和)
[query_parsing_exception] [range] query does not support [day], with { index="usage_2017-04-01" & line=1 & col=83 } (and) [query_parsing_exception] [range] query does not support [day], with { index="usage_2017-04-02" & line=1 & col=83 } (and) [query_parsing_exception] [range] query does not support [day], with { index="usage_2017-04-03" & line=1 & col=83 } (and)
有人可以指出我的问题吗?我知道我可以像上面写的那样写日期(显然我可以用其他语法写日期,但是我正在使用我创建的通用查询生成器生成此搜索调用)
can someone point me to the problem? I understood that i can write the date as i wrote above(obviously i could write it in other syntax but i am generating this search call using a generic query builder i created)
推荐答案
您的范围查询格式不正确,您需要以 yyyy-MM-dd
格式写日期
Your range query is not properly formed, you need to write the date in yyyy-MM-dd
format
client.search({
index: "usage_*",
size : 100,
from: 0,
body: {
query: {
filtered:{
filter:{
bool:{
must: [{"range":{"created":{"gte":"2017-08-09","lt":"now"}}}]
}
}
}
}
}
}
这篇关于带有ElasticSearch的NodeJS-不断获取[query_parsing_exception] [范围]查询不支持[天]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!