I have:
1 2 3 4 5
1 55 4 8 7
8 6 80 40 1
I have my pandas
dataframe
saved on elasticsearch
index
, each row is a document.
Now I want to retrieve all columns that are in list [1,5]
i.e. output shall be:
1 5
1 7
8 1
When I do :
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'])
I get my dataframe
, but I don't want to load it completely, just want to retrieve specific columns, how do I do so?
Probably this won't help me completely, but will be done via filter only ES filter-term-array
UPDATED
Documents on ES are like:
{
"_index": "index_name",
"_type": "dataframe",
"_id": "0",
"_score": 1,
"_source": {
"1": 1,
"2": 55,
"3": 4,
"4": 8,
"5": 7,
"index": 0
}