Reputation: 849
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] 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)
Upvotes: 0
Views: 1280
Reputation: 217254
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"}}}]
}
}
}
}
}
}
Upvotes: 1