Here is the data I’ve added in OpenSearch index
{
"_index": "python-demo-index",
"_type": "_doc",
"_id": "8sdf67a84f-1dsdf",
"_version": 1,
"_score": 0,
"_source": {
"CaseUUID": "8sdf67a84f-1dsdf",
"Type": "Other",
"Question": "BP",
"Summary": "",
"NLP": {
"Question": [
{
"Id": 1,
"BeginOffset": 0,
"EndOffset": 2,
"Score": 0.9824711680412292,
"Text": "BP",
"Category": "TEST_TREATMENT_PROCEDURE",
"Type": "TEST_NAME",
"Traits": [],
"codes": [
"61002-2",
"76284-9",
"8461-6",
"8448-3",
"8447-5",
"8446-7",
"96064-1",
"94144-3",
"83389-7",
"60982-6",
"8434-3",
"34538-9",
"8380-8",
"8454-1",
"60984-2",
"LP156192-9",
"LP156172-1",
"8423-6",
"8478-0",
"8408-7",
"8357-6",
"61011-3",
"60983-4",
"76285-6",
"76213-8",
"8480-6",
"76215-3",
"8379-0",
"86908-1",
"LA17082-1",
"8424-4",
"8450-9",
"75993-6",
"8460-8",
"76214-6",
"LP156206-7",
"8453-3",
"94143-5",
"96066-6",
"8459-0",
"76212-0",
"8462-4",
"8456-6",
"35094-2",
"41901-0",
"8414-5",
"8409-5",
"8458-2",
"76533-9",
"60981-8"
]
}
],
"Summary": []
}
}
}
I want to search by codes [i.e. NLP>Question>list of obj >.codes]
What I did previously is as below.
query = {
"query": {
"simple_query_string": {
"query": "LP156192-9* | 8461-6",
"fields": ["NLP.Question"]
},
},
}
search_response = client.search(
body=query,
index="python-demo-index",
size=100,
request_timeout=15
)
But above code returns empty results?
can you help me with writing search query in python?