0

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)

1 Answer 1

1

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"}}}]
                    }
                }
            }
        }
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.