@Brandon_Kobel Hope this is not too verbose.
Here is a compacted console output showing the two interactions. The first is the _msearch
request and response for the index pattern this-is-my-index-*,-*also*
showing no results. The second is the _msearch
request and response for the index pattern this-is-my-index-*
with the added query NOT _index: *also*
added to remove records in the undesired index. You'll see that there are results in the second response that are only in the desired index this-is-my-index-*
.
Request
POST https://example.com:5601/elasticsearch/_msearch
{
"index": [
"this-is-my-index-*,-*also*"
],
"ignore_unavailable": true,
"preference": 1520949814359
}
{
"version": true,
"size": 500,
"sort": [
{
"@timestamp": {
"order": "desc",
"unmapped_type": "boolean"
}
}
],
"_source": {
"excludes": []
},
"aggs": {
"2": {
"date_histogram": {
"field": "@timestamp",
"interval": "30m",
"time_zone": "America/Chicago",
"min_doc_count": 1
}
}
},
"stored_fields": [
"*"
],
"script_fields": {},
"docvalue_fields": [
"@received_at",
"@timestamp",
"journal.source_realtime_timestamp",
"log.@timestamp",
"received_at"
],
"query": {
"bool": {
"must": [
{
"match_all": {}
},
{
"range": {
"@timestamp": {
"gte": 1520864079230,
"lte": 1520950479230,
"format": "epoch_millis"
}
}
}
],
"filter": [],
"should": [],
"must_not": []
}
},
"highlight": {
"pre_tags": [
"@kibana-highlighted-field@"
],
"post_tags": [
"@/kibana-highlighted-field@"
],
"fields": {
"*": {}
},
"fragment_size": 2147483647
}
}
Response
{
"responses": [
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 0,
"successful": 0,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 0,
"max_score": 0.0,
"hits": []
},
"status": 200
}
]
}
and here is the request using the simplified index pattern this-is-my-index-*
that matches data in both indexes but manually filtering out data from the undesired index:
Request
https://example.com:5601/elasticsearch/_msearch
{
"index": [
"this-is-my-index-*"
],
"ignore_unavailable": true,
"preference": 1520949814359
}
{
"version": true,
"size": 500,
"sort": [
{
"@timestamp": {
"order": "desc",
"unmapped_type": "boolean"
}
}
],
"_source": {
"excludes": []
},
"aggs": {
"2": {
"date_histogram": {
"field": "@timestamp",
"interval": "30m",
"time_zone": "America/Chicago",
"min_doc_count": 1
}
}
},
"stored_fields": [
"*"
],
"script_fields": {},
"docvalue_fields": [
"@received_at",
"@timestamp",
"journal.source_realtime_timestamp",
"log.@timestamp"
],
"query": {
"bool": {
"must": [
{
"query_string": {
"query": "NOT _index: *also*",
"analyze_wildcard": true,
"default_field": "*"
}
},
{
"range": {
"@timestamp": {
"gte": 1520864269438,
"lte": 1520950669438,
"format": "epoch_millis"
}
}
}
],
"filter": [],
"should": [],
"must_not": []
}
},
"highlight": {
"pre_tags": [
"@kibana-highlighted-field@"
],
"post_tags": [
"@/kibana-highlighted-field@"
],
"fields": {
"*": {}
},
"fragment_size": 2147483647
}
}
Response
{
"responses": [
{
"took": 2593,
"timed_out": false,
"_shards": {
"total": 12,
"successful": 12,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 14888525,
"max_score": null,
"hits": [
... snip ...
{
"_index": "this-is-my-index-2018.03",
"_type": "doc",
"_id": "45G5H2IBQ-c6TSCvU0qq",
"_version": 1,
"_score": null,
"_source": {
... snip ...
},
"fields": {
"@received_at": [
"2018-03-13T14:17:42.011Z"
],
"@timestamp": [
"2018-03-13T14:17:39.257Z"
],
"log.@timestamp": [
"2018-03-13T14:17:39.257Z"
]
},
"sort": [
1520950659257
]
},
... snip ...
]
},
"aggregations": {
"2": {
"buckets": [
{
"key_as_string": "2018-03-12T09:00:00.000-05:00",
"key": 1520863200000,
"doc_count": 125021
},
... snip ...
]
}
},
"status": 200
}
]
}