How to combine multiple fields and aggregate docs from it?


I am trying to combine two fields and aggregate for doc count from the combined field.

Let's say I have two fields as following.

"width": 320,
"height": 480

I would like to combine these two fields and create a temporarily field called

"resolution": "320x480"

And then aggregate the document counts based on the "resolution" and sort by it.

I couldn't find any solution for this.
I can only think of creating a new field inside original doc.

Does anyone has a brilliant idea?

(David Pilato) #2

I think you could use that:

That said it will be more efficient if you generate this field at index time.

(system) #3