Is there a possibility to aggregate combinations or permutations in elasticsearch of a single field per document?
Example for combinations for 1 row:
keyword_field : ["test", "array", "for", "combinations"]
<-- aggregate -->
[
[ 'test', 'array' ],
[ 'test', 'for' ],
[ 'test', 'combinations' ],
[ 'array', 'for' ],
[ 'array', 'combinations' ],
[ 'for', 'combinations' ]
]
I want to calculate how often words appear together in a document. Therefore I imagine that I need to calculate combinations independend for every single document and later add them together.
You'll need to create a new column with painless script to achieve this.
The script would work per document, but you can aggregate on the resulting column and get the stats you need.
So, you'll need to:
Note that a scripted field is not going to work, as it does not work with aggregates (last I checked)...