How I can do a query to count all parameters from an index accoding to a specific query. I want to say I do not know do this query with elastichsearch_dsl:
GET my_index/my_type/_count
{
"query": {
"match_all": {}
}
}
for example we have as result this:
{
"count": 2472,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
}
}
Thanks in advance
there is a count method to do this, it returns the number of matching docs:
from elasticsearch_dsl import Search
s = Seacrh(index='my_index', doc_type='my_type')
s = s.query(...)
print(s.count())
Hope this helps.
hello
petite question .
je suis tous nouveau sur ES et python et j'ai vraiment du mal avec si quelqun pourrait m'aider ca serai cool.
j'aimerai faire un script python qui va checker sur ES a l'aide d'une requette : le nombre d'IP differente, nombre de user different et le nombre de machine differente tri茅 par nom puis apres identifi茅 les machines sur lesquelle un compte s'est connecte avec un tri sur le timestamp.
est'il possible de le faire en realite ?
si oui possible d'avoir quelque piste svp?
actuellement je bloque a ce stade:
from elasticsearch import Elasticsearch
es = Elasticsearch(['localhost:9200'])
res = es.search(
index='test-*',
body={
"query": {
"match": {
"message": " "
}
}
print(res)
)
merci d'avance
Most helpful comment
there is a
countmethod to do this, it returns the number of matching docs:Hope this helps.