Data missing when we are using doc value fields for a date type

Data missing when we are using doc value fields for a "Date" Type.

We are querying for dates and getting through doc values fields. Some times it is working fine and some times dates are missing even dates are available. What might be the issue? Is there any issue with doc fields for date type?

Also,we have dates data available in the format of "dd-mm-yyyy" but doc value fields is returning the date in the response as format of "2018-08-25T00:00:00.000Z".

Please find the mapping for the date is like below. Is anything wrong in this?

"when": {
"type": "date",
"format": "dd-MM-yyyy"
}

Elastic Query:

{

"query" : {
"bool" : {
"must" : [
{
"match" : {
"site" : {
"query" : "CR",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"boost" : 1.0
}
}
},
{
"match" : {
"type" : {
"query" : "ITINERARY",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"boost" : 1.0
}
}
},
{
"nested" : {
"query" : {
"bool" : {
"must" : [
{
"match" : {
"routes.arrPoint.code" : {
"query" : "GRC ESP",
"operator" : "OR",
"prefix_length" : 0,
"max_expansions" : 50,
"fuzzy_transpositions" : true,
"lenient" : false,
"zero_terms_query" : "NONE",
"boost" : 1.0
}
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
},
"path" : "routes",
"ignore_unmapped" : false,
"score_mode" : "avg",
"boost" : 1.0,
"inner_hits" : {
"ignore_unmapped" : false,
"from" : 0,
"size" : 1000,
"version" : false,
"explain" : false,
"track_scores" : false,
"_source" : false,
"docvalue_fields" : [
"routes.when"
]
}
}
}
],
"disable_coord" : false,
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
, "_source": false
}

From the above query, i am trying to fetch the dates based on some conditions like departure and arrival points . In the above query, we have a condition on "routes.arrPoint.code", here we can get multiple values like "GRC", "ESP" etc. When we are passing multiple values, some data is missing either for GRC or ESP. We want to know whether it is the issue with "doc value fields" or "date format" or "multiple value in the match query"?

Please help me to resolve this scenario and let me know if any more info is required.

Actually we are using the Elastic Search 6.1 version.

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