Failure to parce query

I'm very new to elasticsearch so please forgive me if this is a stupid question. I'm writing python code to read data from the stack but from time to time I get a message like this:

Exception: Invalid Query: [erm/d-2CllN-ReyNWTL4WCbUDg] org.elasticsearch.index.query.QueryShardException: Failed to parse query [_id : -9bYmIYBZFb2o7rVRi3s]; org.apache.lucene.queryparser.classic.ParseException: Cannot parse '_id : -9bYmIYBZFb2o7rVRi3s': Encountered " "-" "- "" at line 1, column 6.
Was expecting one of:
    <BAREOPER> ...
    "(" ...
    "*" ...
    <QUOTED> ...
    <TERM> ...
    <PREFIXTERM> ...
    <WILDTERM> ...
    <REGEXPTERM> ...
    "[" ...
    "{" ...
    <NUMBER> ...

It only occurs when the _id starts with the - character. Any help would be greatly appreciated.

Hi @mikes1962,

Are you using the Elasticsearch Python client? Which version of the client and Elasticsearch are you using?

I agree that the '-' character at the start is causing the issue. Can you share the code and query you are trying to run?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.