I have my apriori result save on elasticsearch index as:
index | antecedents | consequents ...other fields
1 | [1,2] | [8]
2 | [1] | [55]
3 | [82] | [8,99]
Now I want to retrieve consequents if antecedent match:
[1,2] or related i.e. using match rather than term (not match exactly)
and the output shall be [[8],[55]] ordered by score of match
I want to get them form pandas or python query, what I am doing by now is:
from elasticsearch import Elasticsearch
from pandas.io.json import json_normalize
res = es.search(index="index_name", body={ "query": {"match_all": {}}})
df = json_normalize(res['hits']['hits'])
This is how I am by now retrieving records, I need the elasticsearch query to do so!
Also I looked at: Similar ES question, but I here want the field and not includes
The documents are like:
{
"_id": 1,
"antecedents": [1,2]
"consequents": [8]
...other fields
}