I am relatively new to Solr and I am trying to achieve the following: get all records where a certain field matches the current date (e.g. 16/04/2021 00:00 to 16/04/2021 23:59).
I have looked at the docs, but there aren't many examples.
Could someone please point me in the right direction?
Thanks
Based on information in the Working with dates section of the reference guide:
datefield:[2021-04-16T00:00:00Z TO 2021-04-17T00:00:00Z}
The } and the end indicates "not inclusive", so everything up to, but not actually inside the next day. You could use .. TO 2021-04-16T23:59:59.999Z] or something similar as well, but it's probably better to be explicit.
Related
I'm attempting to understand what exactly date-fns is doing when using parseISO() as it seems to be adding 2 hours to the time that I have saved in the database. The data is as follows:
ISO Date/Time saved in database: 2022-09-20T19:52:53.000Z
Using format(parseISO(2022-09-20T19:52:53.000Z), "HH:mm:ss") I get this: 21:52:53 hrs
Somewhere along the line 2 hours are being added and unsure as to the cause. A comment left by Monash Joshi in (stackoverflow issue) hints towards an explanation but not really a solution. Want I want to show is just the parsed date/time value as it is. Would it thus make sense to manipulate the string that I receive from the database myself?
Thanks in advance for your help! And let me know if you need any further information.
I have a lot of data in my postgres database( on a remote). This is the data of the past 1 year, and I want to push it to elasticsearch now.
The data has a time field in it in this format 2016-09-07 19:26:36.817039+00.
I want this to be the timefield(#timestamp) in elasticsearch. So that I can view it in kibana, and see some visualizations over the last year.
I need help on how do I push all this data efficiently. I cannot get that how do I get all this data from postgres.
I know we can inject data via jdbc plugin, but I think I cannot create my #timestamp field with that.
I also know about zombodb but not sure if that also gives me feature to give my own timefield.
Also, the data is in bulk, so I am looking for an efficient solution
I need help on how I can do this. So, suggestions are welcome.
I know we can inject data via jdbc plugin, but I think I cannot create
my #timestamp field with that.
This should be doable with Logstash. The first starting point should probably be this blog post. And remember that Logstash always consists of 3 parts:
Input: JDBC input. If you only need to import once, skip the schedule otherwise set the right timing in cron syntax.
Filter: This one is not part of the blog post. You will need to use the Date filter to set the right #timestamp value — adding an example at the end.
Output: This is simply the Elasticsearch output.
This will depend on the format and field name of the timestamp value in PostgreSQL, but the filter part should look something like this:
date {
match => ["your_date_field", "dd-mm-YYYY HH:mm:ss"]
remove_field => "your_date_field" # Remove now redundant field, since we're storing it in #timestamp (the default target of date)
}
If you're concerned with the performance:
You will need to set the right jdbc_fetch_size.
Elasticsearch output is batched by default.
I'm running Bugzilla 4.2.5. I would like to save a search to see what I worked on yesterday - so anything that I recorded any time against, or updated the comments for.
I'm hoping that I can then use the output to help with my daily scrum question "what did you do yesterday?"
When I go into search -> Advanced Search, I can see a "Search by change history" section which looks exactly like what I'd like to use.
So to test it, I've recorded one hour on a bug assigned to me. I want to be able to find that bug as changed in the last day.
So I go to the "Change history" section, select the field "Hours worked" - (is there a wildcard I can put in changed to?) In any case I know it has transitioned from zero to 1 hours, so I'll enter "1" into that field.
Next comes the dates, where it says I can enter YYYY-MM-DD or relative dates. How do I do a relative date for changed between yesterday and today...? In any case I'll look between 2013-01-01 and 2013-12-31.
It brings back Zarro Boogs Found. So what am I doing wrong with the search, I know that I've just changed a bug I'm working on and set one hour of time to it.
I'm hoping someone can help, I've had a good search around for documentation and tried for hours to get this working! Thanks!
Aha, I've found it,
Advanced search, Custom search, "Hours worked" -> "Changed after" -> "1d"
Thanks! :)
I need to check if is missing 10 days or less to arrive at a certain date.
I'm trying this:
if(date('d/m/Y') >= CakeTime::format('d/m/Y','30/04/2013','-10 days', true )) {
but apparently the Caketime::format is not working correctly.
Any help, pls?
CakePHP doesn't prevent you from using regular PHP functionality. If PHP itself already offers what you're looking for, it is even prefered.
In PHP, you can calculate the difference between two dates using DateTime::diff()
A quick search on StackOverflow gave me this question, which contains proper examples:
Date Difference in php on days?
I'm trying to create a new column based on my main project's Date column that pulls timeline events from another Google Refine project:
cell.cross("Clean5 Timeline", "TimelineDate").cells["TimelineEvent"].value[0]
The dates are in the same format in both Google Refine projects. But it fills no cells, and I get this error:
Error: Cannot retrieve field from null
This —
cell.cross("Clean5 Timeline", "TimelineDate")
— returns [ ] for rows where there should be a match.
And this —
cell.cross("Clean5 Timeline", "TimelineDate").cells["TimelineEvent"]
— returns null for those rows.
I copied the syntax directly from the GREL help files: http://code.google.com/p/google-refine/wiki/GRELOtherFunctions. Can anyone suggest what I may be overlooking?
Thanks.
Without access to your projects it's going to be difficult to answer this, but the first thing I'd suggest is that you trim back your expression to find out exactly where the null is coming from.
Since
cell.cross("Clean5 Timeline", "TimelineDate")
is returning an empty array ([]), nothing based on that result is going to work.
There are three possible problems that I can think of: 1) the project name is wrong, 2) the column name is wrong, 3) the data values don't match (or Refine doesn't think they do), or 4) you are running into a caching bug with cross() that exists in Refine 2.5.
Restarting the Refine server should clear the cache if you're running into the bug and it's also fixed in the current source repository. The fix will be included in OpenRefine 2.6.