Hi I am having an elastic search instance running in a docker container . I have two queries , each of the the query i put in an files namely query6.json and query7.json. both files contains identical queries.
when i run one of the query using curl command it provides the result .
curl -XGET http://localhost:55083/mep-reports*/_search?pretty -H "Content-Type: application/json" -d @query6.json
result of the above query returns the following result
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 100,
"relation": "eq"
},
"max_score": null,
"hits": [
{
"_index": "mep-reports",
"_type": "_doc",
"_id": "nMQ0N3wBcQytyR4tsuFr",
"_score": null,
"_source": {
"inventory": "SMS",
"msg_text": "This is random text",
"status": "ENROUTE",
"@timestamp": "2019-09-10T07:06:26.287Z",
"o_error": "",
"flight_id": "92348fa1-ca6c-456a-b3b2-85fba2d2deed",
"recipient": "420736408281",
"account_id": "a56f7e14-20f9-40e6-90c6-10604140ac5f",
"sender": "8800111",
"campaign_id": "6f2abca3-b46d-43f3-91be-3278a8dd7dc0",
"nof_segments": 1,
"@version": 1,
"submission_ts": 1568105380000000,
"delivery_ts": 1553616888000000,
"campaign_name": "Starbucks Promotion",
"flight_name": "Extremely very very long flight",
"campaign_type": "NON_MARKETING",
"created_by": "0c9d6015-f45f-4a90-a58c-8c99384aa40",
"first_name": "Campaign",
"last_name": "Manager"
},
"sort": [
1568099186287
]
},
{
"_index": "mep-reports",
"_type": "_doc",
"_id": "k8Q0N3wBcQytyR4tsuFr",
"_score": null,
"_source": {
"inventory": "SMS",
"msg_text": "This is random text",
"status": "ENROUTE",
"@timestamp": "2019-09-09T20:45:32.087Z",
"o_error": "",
"flight_id": "92348fa1-ca6c-456a-b3b2-85fba2d2deed",
"recipient": "420736408283",
"account_id": "a56f7e14-20f9-40e6-90c6-10604140ac5f",
"sender": "8800111",
"campaign_id": "6f2abca3-b46d-43f3-91be-3278a8dd7dc0",
"nof_segments": 1,
"@version": 1,
"submission_ts": 1568105380000000,
"delivery_ts": 1563144156000000,
"campaign_name": "Starbucks Promotion",
"flight_name": "Short Flight",
"campaign_type": "NON_MARKETING",
"created_by": "0c9d6015-f45f-4a90-a58c-8c99384aa40",
"first_name": "Campaign",
"last_name": "Manager"
},
"sort": [
1568061932087
]
}
]
}
}
when i run the second query from the second file it returns no result
curl -XGET http://localhost:55083/mep-reports*/_search?pretty -H "Content-Type: application/json" -d @query7.json
output
{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
}
}
I compared the files in a tool & the seems identical.
I also did a diff and here is the following result.
diff query6.json query7.json
47,50c47,53
< {
< "terms": {
< "created_by": ["0c9d6015-f45f-4a90-a58c-8c99384aa40","0c9d6015-f45f-4a90-a58c-8c99384aa41"] }
< }
---
> {
> "terms": {
> "created_by": [
> "0c9d6015-f45f-4a90-a58c-08c99384aa40", "0c9d6015-f45f-4a90-a58c-08c99384aa41"
> ]
> }
> }
the files seems identical interms of the content .
please find the files along here
query6.json
{
"from": 0,
"size": 10,
"timeout": "300s",
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"from": "2019-08-31T23:00:00.000Z",
"to": null,
"include_lower": true,
"include_upper": true,
"format": "yyyy-MM-dd'T'HH:mm:ss.SSSX",
"boost": 1.0
}
}
},
{
"range": {
"@timestamp": {
"from": null,
"to": "2019-09-12T07:06:26.287Z",
"include_lower": true,
"include_upper": true,
"format": "yyyy-MM-dd'T'HH:mm:ss.SSSX",
"boost": 1.0
}
}
},
{
"match": {
"account_id": {
"query": "a56f7e14-20f9-40e6-90c6-10604140ac5f",
"operator": "OR",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": true,
"lenient": false,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"boost": 1.0
}
}
},
{
"terms": {
"created_by": ["0c9d6015-f45f-4a90-a58c-8c99384aa40","0c9d6015-f45f-4a90-a58c-8c99384aa41"] }
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
query7.json
{
"from": 0,
"size": 10,
"timeout": "300s",
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"from": "2019-08-31T23:00:00.000Z",
"to": null,
"include_lower": true,
"include_upper": true,
"format": "yyyy-MM-dd'T'HH:mm:ss.SSSX",
"boost": 1.0
}
}
},
{
"range": {
"@timestamp": {
"from": null,
"to": "2019-09-12T07:06:26.287Z",
"include_lower": true,
"include_upper": true,
"format": "yyyy-MM-dd'T'HH:mm:ss.SSSX",
"boost": 1.0
}
}
},
{
"match": {
"account_id": {
"query": "a56f7e14-20f9-40e6-90c6-10604140ac5f",
"operator": "OR",
"prefix_length": 0,
"max_expansions": 50,
"fuzzy_transpositions": true,
"lenient": false,
"zero_terms_query": "NONE",
"auto_generate_synonyms_phrase_query": true,
"boost": 1.0
}
}
},
{
"terms": {
"created_by": [
"0c9d6015-f45f-4a90-a58c-08c99384aa40", "0c9d6015-f45f-4a90-a58c-08c99384aa41"
]
}
}
],
"adjust_pure_negative": true,
"boost": 1.0
}
},
"sort": [
{
"@timestamp": {
"order": "desc"
}
}
]
}
appreciate if you can help thank you
CodePudding user response:
There are differences here:
{
"terms":{
"created_by":[
"0c9d6015-f45f-4a90-a58c-8c99384aa40",
"0c9d6015-f45f-4a90-a58c-8c99384aa41"
]
}
}
{
"terms":{
"created_by":[
"0c9d6015-f45f-4a90-a58c-08c99384aa40",
"0c9d6015-f45f-4a90-a58c-08c99384aa41"
]
}
}
Αn extra 0
character.