How to remove fields from response


(Kamil P) #1
search_month = model.search().query(q_objects)
search_month.aggs.bucket(
        source_month, 'date_histogram', field='date',
        interval=date_ranges[source_month].interval,
    )
response_month = search_month.execute()

Unfortunately, it gives me all data from the model - but how to show only results of aggregations - count of documents ?


(David Pilato) #2

Set size parameter to 0.


(Kamil P) #3

Unfortunately looks like cannot use size=0 on aggregations with date_histogram. Perhaps its just elasticsearch_dsl python library problem ?

TransportError(400, 'illegal_argument_exception', '[date_histogram] unknown field [size], parser not found')

(David Pilato) #4

I don't know this client but my guess is that it should be something like:

.search().query(q_objects).size(0)

(system) #5

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