I want to query an opensearch index and to retrieve only the _source inside the hits tag. I tried to make the request in Postman like:
GET: http://localhost:9200/my_index/_search?q="product1234"?format=json?filter_path=hits.hits._source
but this also gets me the metadata and all the other informative fields, like:
{
"took": 17,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 44,
"relation": "eq"
},
"max_score": 4.2769747,
"hits": [
{
"_index": "os_fcpq_index",
"_id": "300",
"_score": 4.2769747,
"_source": {...
I want to be able to retrieve a json that contains only the values that are inside the _source tag, like:
[{'_source': {'product_id': '1234'...}}]
I also looked over the opensearch documentation and it is possible to use the argument filter_path, but in my example it seems I am missing something...
You have too many ?
in your URL, you need to separate each query string parameter with &
instead of ?
GET: http://localhost:9200/my_index/_search?q="product1234"&format=json&filter_path=hits.hits._source
^ ^
| |