<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_input_ids(query, limit=None):
 """Get the ids of existing input documents that match a query"""

    docs = scan(_es, index=esconfig.ES_INPUT_INDEX,
                doc_type=esconfig.ES_INPUT_DOCTYPE,
                query=query, size=(limit or 1000), fields="")
    for i, a in enumerate(docs):
        if limit and i >= limit:
            return
        yield a['_id']