Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
2.5
Describe the issue:
I want to fetch the hits value of opensearch through logstash. Through curl command i am getting the results but using the same config in logstash does not giving the hits value/
Configuration:
curl -XGET -uusername:password "https://localhost/test*/_search" -H 'Content-Type: application/json' -d' { "size": 0, "query": { "bool": { "must": [], "filter": [
{ "match_phrase": { "type": "msg" }
},
{
"range": {
"@timestamp": {
"gte": "now-1d/d","lt": "now/d"
}
}
}
],
"should": [],
"must_not": []
}
},
"track_total_hits": true
}'
For the above command
{"took":6,"timed_out":false,"_shards":{"total":30,"successful":30,"skipped":0,"failed":0},"hits":{"total":{"value":55828,"relation":"eq"},"max_score":null,"hits":[]}}
Logstash config
input {
opensearch {
hosts => ["https://localhost"]
index => "test*"
query => '{ "size": 0,
"query": {
"bool": {
"must": [],
"filter": [
{
"match_phrase": {
"type": "msg"
}
},
{
"range": {
"@timestamp": {
"gte": "now-1d/d","lt": "now/d"
}
}
}
],
"should": [],
"must_not": []
}
},
"track_total_hits": true
}'
size => 10000
docinfo => true
schedule => "0 1 * * *"
user => "username"
password => "password"
}
}
output{
file { path => "/usr/share/logstash/test/sample.log" }
}
But is I used the same config is logstash it is not giving the hits value.
One more thing noticed the size parameter in logstash config is not working as expected. Ideally when the size is 0 it should only show the hits result.
Could you please help us in debugging the issue?