Hi, I want to ask a thing in Elasticsearch. If I want to ignore a document based on a certain field value, how can I do that in the flatmap function of javascript

Hi, I want to ask a thing in Elasticsearch. If I want to ignore a document based on a certain field value, how can I do that in the flatmap function of javascript

const body = datajson.flatMap((doc: Resource) => [
    { index: { _index: index, _id: doc.id } },
    {
      title: doc.title,
      shortDescription: doc.shortDescription,
      description: doc.description,
    }
]))

In the document, there is a field called status which is 'active' or 'inactive'.
I want to ignore the documents whose status are inactive