# Failure to parce query

**URL:** <https://discuss.elastic.co/t/failure-to-parce-query/326699>\
**Category:** Kibana\
**Created:** [February 28, 2023, 5:11pm UTC](https://discuss.elastic.co/t/failure-to-parce-query/326699 "2023-02-28T17:11:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikes1962](https://avatars.discourse-cdn.com/v4/letter/m/3ec8ea/32.png) [@mikes1962](https://discuss.elastic.co/u/mikes1962)\
**Post date:** [February 28, 2023, 5:11pm UTC](https://discuss.elastic.co/t/failure-to-parce-query/326699/1 "2023-02-28T17:11:27Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [March 1, 2023, 10:27am UTC](https://discuss.elastic.co/t/failure-to-parce-query/326699/2 "2023-03-01T10:27:32Z")

</div>

Hi @mikes1962,

Are you using the [Elasticsearch Python client](https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/index.html)? 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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 29, 2023, 10:28am UTC](https://discuss.elastic.co/t/failure-to-parce-query/326699/3 "2023-03-29T10:28:13Z")

</div>

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