redis-om-python icon indicating copy to clipboard operation
redis-om-python copied to clipboard

Field projection using JSON Path expressions

Open gam-phon opened this issue 2 years ago • 1 comments

Hello,

Sometimes an object is huge and only want to return from Redis subset of the data

https://oss.redis.com/redisjson/indexing_JSON/#field-projection

gam-phon avatar Jan 02 '22 10:01 gam-phon

For now, I am using the low level

redis = self.db()
args = [
    "FT.SEARCH",
     Model.Meta.index_name,
     f"(@field_1:{{{self.pk}}}) (@field_2:{{value_2}})",
     "RETURN",
     "2",
     "$.field_3",
     "$.field_4",
]
redis.execute_command(*args)

gam-phon avatar Jan 02 '22 13:01 gam-phon