ElasticSearch-Äquivalent zu MongoDB .count()
English
Deutsch
The ElasticSearch equivalent to MongoDB’s count() is also called count. It can be used in a similar way
Wenn du eine ElasticSearch-Abfrage wie diese hast (Beispiel in Python)
es_equivalent_count.py
result = es.search(index="my_index", body={
"query": {
"match": {
"my_field": "my_value"
}
}
})
result_docs = [hit["_source"] for hit in result["hits"]["hits"]]kannst du es einfach zu einer Nur-Count-Abfrage ändern, indem du search durch count ersetzt:
es_count_query.py
result = es.count(index="my_index", body={
"query": {
"match": {
"my_field": "my_value"
}
}
})
result_count = result["count"] # z.B. 200Check out similar posts by category:
Databases, ElasticSearch
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow