Aggregation with multiple condition returning False values

Hi Team,

I tried 2 ways to do this.

In one solution I am using 2 filter terms inside filter bool. That is shown below:

GET experiment_air/_search
{
"size": 5,
"aggs": {
"creations": {
"filter": {
"bool": {
"filter": [
{ "term" : { "refillProfileID.keyword": "ACT" } },
{ "term" : { "act_flag.keyword": "N" } }
]
}
}
}
}
}

In other solution I am using must with 2 terms inside filter bool. This is shown below:

GET experiment_air/_search
{
"aggs": {
"creations": {
"filter": {
"bool": {
"must":[
{ "term" : { "refillProfileID.keyword": "ACT" }
},
{ "term" : { "act_flag.keyword": "N" }
}
]
}
}
}
}
}

My question is count of aggregation is coming same in both the queries. Only question is search query on aggregation give me false impression about its validity.

Attached is sample output as well.

{
"took" : 43,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "c1Un53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "1060_100_N",
"transactionType" : 0,
"@timestamp" : "2019-12-01T15:30:43.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "100",
"accountInformationBeforeRefill_accountFlags" : "00000000",
"voucherSerialNumber" : null,
"air_plan_id" : "1060",
"act_flag" : "N",
"accountInformationAfterRefill_accountFlags" : "100"
}
},
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "dFUn53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "2111_650_N",
"transactionType" : 0,
"@timestamp" : "2019-12-29T15:09:01.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "650",
"accountInformationBeforeRefill_accountFlags" : "0000",
"voucherSerialNumber" : null,
"air_plan_id" : "2111",
"act_flag" : "N",
"accountInformationAfterRefill_accountFlags" : "100"
}
},
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "dVUn53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "180_650_Y",
"transactionType" : 0,
"@timestamp" : "2019-12-24T03:50:59.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "650",
"accountInformationBeforeRefill_accountFlags" : "00000000",
"voucherSerialNumber" : null,
"air_plan_id" : "180",
"act_flag" : "Y",
"accountInformationAfterRefill_accountFlags" : "10000000"
}
},
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "dlUn53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "2106_298_N",
"transactionType" : 0,
"@timestamp" : "2019-12-10T07:43:56.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "298",
"accountInformationBeforeRefill_accountFlags" : "10000000",
"voucherSerialNumber" : null,
"air_plan_id" : "2106",
"act_flag" : "N",
"accountInformationAfterRefill_accountFlags" : "10000000"
}
},
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "d1Un53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "2110_650_N",
"transactionType" : 0,
"@timestamp" : "2019-12-13T03:42:33.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "650",
"accountInformationBeforeRefill_accountFlags" : "10000000",
"voucherSerialNumber" : null,
"air_plan_id" : "2110",
"act_flag" : "N",
"accountInformationAfterRefill_accountFlags" : "00000000"
}
},
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "eFUn53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "1095_468_Y",
"transactionType" : 0,
"@timestamp" : "2019-12-07T10:38:03.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "468",
"accountInformationBeforeRefill_accountFlags" : "00000000",
"voucherSerialNumber" : null,
"air_plan_id" : "1095",
"act_flag" : "Y",
"accountInformationAfterRefill_accountFlags" : "10000000"
}
},
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "eVUn53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "1014_ALL_N",
"transactionType" : 0,
"@timestamp" : "2019-12-10T15:12:46.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "ALL",
"accountInformationBeforeRefill_accountFlags" : "0000",
"voucherSerialNumber" : null,
"air_plan_id" : "1014",
"act_flag" : "N",
"accountInformationAfterRefill_accountFlags" : "00000000"
}
},
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "elUn53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "1015_650_N",
"transactionType" : 0,
"@timestamp" : "2019-12-09T11:06:44.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "650",
"accountInformationBeforeRefill_accountFlags" : "0000",
"voucherSerialNumber" : null,
"air_plan_id" : "1015",
"act_flag" : "N",
"accountInformationAfterRefill_accountFlags" : "00000000"
}
},
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "e1Un53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "2111_120_N",
"transactionType" : 0,
"@timestamp" : "2019-12-19T16:45:58.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "120",
"accountInformationBeforeRefill_accountFlags" : "0000",
"voucherSerialNumber" : null,
"air_plan_id" : "2111",
"act_flag" : "N",
"accountInformationAfterRefill_accountFlags" : "100"
}
},
{
"_index" : "experiment_air",
"_type" : "_doc",
"_id" : "fFUn53ABBfwfMRwg0vOO",
"_score" : 1.0,
"_source" : {
"refillType" : "2",
"accountNumber" : "61434135105",
"transactionAmount" : 30.0,
"transactionCode" : "Standard",
"air_plan_status" : "1014_ACT_N",
"transactionType" : 0,
"@timestamp" : "2019-12-01T02:01:03.000Z",
"segmentationID" : "S003",
"locationNumber" : null,
"refillProfileID" : "ACT",
"accountInformationBeforeRefill_accountFlags" : "0000",
"voucherSerialNumber" : null,
"air_plan_id" : "1014",
"act_flag" : "N",
"accountInformationAfterRefill_accountFlags" : "10000000"
}
}
]
},
"aggregations" : {
"creations" : {
"doc_count" : 33365
}
}
}

My question is why, refillProfileID and act_flag whose value is not '2120' and 'N' respectively are coming in this search query result.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.