Hi Everyone,
I’m wondering whether it is possible for a query to return a subset of a text field. I have a query that returns documents of interest based on a combination of filter terms and match phrases, see below. I’m wondering if it is possible to do some kind of regular expression type operation in opensearch to return a subset of doc_text - in this case it would be between “home address” and the end of line. Obviously it is possible to do that in python after retrieving the document, but it would be nice to not send the entire text document.
Thanks
query = {
“query” : {
“bool”: {
“filter”: {
“terms”: {“person_id”: pt_list}
},
“must”: [
{“match_phrase”: {
“doc_text” : “home address”
}
}
]
}
},
“fields” : [“doc_id”, “doc_text”],
“_source”: False
}