Query doesn't have any hits with date condition

Hi everyone, I'm beginner and i have a question. I created a index which contains some documents. But there are no any hits when i search the documents with the below query.

Then, I deleted the date condition,and the below screenshot is the result of the new query.
so,why i can't use the range?

this is mappings

{
"mapping": {
"properties": {
"bf_info": {
"type": "text"
},
"build": {
"type": "text"
},
"deviceName": {
"type": "text"
},
"deviceType": {
"type": "text"
},
"deviceUniqueIdentifier": {
"type": "text"
},
"doc": {
"properties": {
"bf_info": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"build": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"deviceName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"deviceType": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"deviceUniqueIdentifier": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"graphicsDeviceName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"graphicsDeviceVendor": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"graphicsMemorySize": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"graphicsPixelFillrate": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"id": {
"type": "long"
},
"language": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"loadedLevelName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"maxTextureSize": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"operatingSystem": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"platform": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"playerId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"processorCount": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"processorType": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"resolutionHeight": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"resolutionWidth": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"serverIP": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"serverId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"server_date": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"stack": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"systemMemorySize": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"timestamp": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"unityVersion": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"graphicsDeviceName": {
"type": "text"
},
"graphicsDeviceVendor": {
"type": "text"
},
"graphicsMemorySize": {
"type": "text"
},
"graphicsPixelFillrate": {
"type": "text"
},
"id": {
"type": "integer"
},
"language": {
"type": "text"
},
"loadedLevelName": {
"type": "text"
},
"maxTextureSize": {
"type": "text"
},
"message": {
"type": "text"
},
"operatingSystem": {
"type": "text"
},
"platform": {
"type": "text"
},
"playerId": {
"type": "text"
},
"processorCount": {
"type": "text"
},
"processorType": {
"type": "text"
},
"resolutionHeight": {
"type": "text"
},
"resolutionWidth": {
"type": "text"
},
"serverIP": {
"type": "text"
},
"serverId": {
"type": "text"
},
"server_date": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
},
"stack": {
"type": "text"
},
"systemMemorySize": {
"type": "text"
},
"timestamp": {
"type": "integer"
},
"unityVersion": {
"type": "text"
},
"version": {
"type": "text"
}
}
}
}

In your mapping you've set server_date to "type": "text" which I doubt will work with your range query, instead you should set it so something like this:

"server_date": {
   "type": "date",
   "format": "strict_date_optional_time"
},

That's the mapping I use and it allows me to perform range queries on date.

2 Likes

Welcome!

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with </> icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

Thank you, I will check my mappings and correct it.

sorry. I will rewrite it.

Hi, guy, I'm confused. I set the type of "server_date" as "date" type, but it's not。
so, maybe I need to set some settings or other?

PUT /error_log
{
  "mappings" : {
    "properties": {
    "id" : { "type" : "integer" },
    "timestamp" : { "type" : "keyword" },
    "version" : {"type" :"keyword"},
    "build" : {"type" :"keyword"},
    "message" : {"type" :"text"},
    "stack" : {"type" :"text"},
    "platform" : {"type" :"keyword"},
    "serverIP" : {"type" :"keyword"},
    "serverId" : {"type" :"keyword"},
    "playerId" : {"type" :"keyword"},
    "deviceName" : {"type" :"keyword"},
    "deviceType" : {"type" :"keyword"},
    "deviceUniqueIdentifier" : {"type" :"keyword"},
    "operatingSystem" : {"type" :"keyword"},
    "language" : {"type" :"keyword"},
    "systemMemorySize" : {"type" :"keyword"},
    "processorCount" : {"type" :"keyword"},
    "processorType" : {"type" :"keyword"},
    "resolutionWidth" : {"type" :"keyword"},
    "resolutionHeight" : {"type" :"keyword"},
    "graphicsDeviceName" : {"type" :"keyword"},
    "graphicsDeviceVendor" : {"type" :"keyword"},
    "graphicsMemorySize" : {"type" :"keyword"},
    "graphicsPixelFillrate" : {"type" :"keyword"},
    "maxTextureSize" : {"type" :"keyword"},
    "loadedLevelName" : {"type" :"keyword"},
    "unityVersion" : {"type" :"keyword"},
    "bf_info" : {"type": "text"},
    "server_date" : {"type" : "date" , "format" :"yyyy-MM-dd HH:mm:ss"}
    }
  }
}

Ok, friend, i have found the mistake that I uploaded some incorrect documents.

thank you for your help

1 Like

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