"How can I retrieve matched nested fields without parent documents in OpenSearch?"

27 Views Asked by At

In OpenSearch, I'm working with an index that includes a nested field named "chunks," containing vectors for semantic search. Due to openai's token limit, each document will be chunked and stored in this nested field. During a search operation, I want to retrieve matched nested fields without including the parent document in the hits. While experimenting with inner_hits, I found that it still organizes the nested field results by the parent document. Ideally, I'm seeking a flattened representation of all data within inner_hits – essentially treating the nested documents as if they were the direct hits from the search results. Since I am performing semantic search, the relationship of the nested fields to the parent document does not matter in this case. I've reviewed the documentation but haven't found any information on achieving this. Is there a way to accomplish this in OpenSearch, or is there a workaround that achieves a similar outcome?

0

There are 0 best solutions below