Incauto
(Incauto)
August 25, 2020, 3:23am
1
Hi, in an index I have fields for interface and host, a host has many interfaces:
HOST-01 : interface01, interface02
HOST-02 : interface01, interface02
and I want to filter a specific interface for a especific host for example: interface01 from HOST-01 and interface02 for HOST-02
How can I do this with a DSL query?
I know how to filter by host, but I cant figure out how to filter a specific interface for a especific host.
{
"query": {
"bool": {
"must": {
"terms": {
"node_name.keyword": [
"HOST-01"
"HOST-02"
]
}
}
}
}
}
Hi @Incauto ,
I've created this example with kibana_sample_data_ecommerce that I think is close to what you're looking for:
We're filtering for men's clothing on friday OR women's clothing on Monday. Take a look and let me know if that's helpful
GET /kibana_sample_data_ecommerce/_search
{
"size": 0,
"aggs": {
"agg_name": {
"filters": {
"filters": {
"men and friday": {
"bool": {
"filter": [
{
"bool": {
"should": [
{
"match_phrase": {
"category.keyword": "Men's Clothing"
}
}
],
"minimum_should_match": 1
}
},
{
"bool": {
"should": [
{
"match_phrase": {
"day_of_week": "Friday"
}
}
],
"minimum_should_match": 1
}
}
]
}
},
"women and monday": {
"bool": {
"filter": [
{
"bool": {
"should": [
{
"match_phrase": {
"category.keyword": "Women's Clothing"
}
}
],
"minimum_should_match": 1
}
},
{
"bool": {
"should": [
{
"match_phrase": {
"day_of_week": "Monday"
}
}
],
"minimum_should_match": 1
}
}
]
}
}
}
}
}
}
}
system
(system)
Closed
September 24, 2020, 11:36am
3
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.