How to build data for promotion in elasticsearch - elasticsearch-2.0

I want to build some promotion price for products for listing by elasticsearch 2.3. The price will be changed by current time.
Example: Product A 3 - 5pm: 3$ / 4 - 4.30pm: 2$. If the current time is 4.15pm, the price will be 2$. After 4.30pm, it will be 3$.
I can't find the solution for elasticsearch 2.3. I should use inner object, nested or parent/child. Can you help me?

Related

Need to do a cross reference in Excel

I am needing to check that our Master Schedule is reflecting all physical work that falls into our SOW(Statement of Work).
I have a sheet that does this fairly simply, but I want to make it a simple cut and paste from our Schedule export, and that way it reflects that it is looking at current data vs data from several months ago.
I can handle the date part, but I can't seem to get the logic in my head right for how I should reference the data to double-check compliance.
Each SOW Paragraph has a number assigned to it, and that is what each task would refer to.
Activity Type
Activity ID
CAM
WBS
OBS
% Complete
SOW
ASAP
49.3.4.2.3.2.030
Pam
77.4.1.2
C.11.1
20%
1.0
ASAP
C2_4.20.010.011
Shaun
77.3.1
C.5.4.2
15%
3.6.1.2
ASAP
C2_4.20.010.012
Shaun
77.3.1
C.5.4.2
0%
3.6.1.2
ASAP
69.HP.5.1.2.15.30
Mark
77.1.1
C.11.1
50%
3.2
ASAP
C2_6.1.5.15
Brett
77.2.1
C.3.2.1
100%
5.0
ASAP
C2_2.10.55
Susan
77.2.1
C.5.4.1
60%
6.0
ASAP
29.3.2.11.1.20
Eric
77.4.1
C.11.1
20%
1.0
ASAP
1Z.DIL.0025
Adam
77.1.1
C.1.1
10%
1.1.2
Say this image is an export from our schedule.
I need to make sure that those SOW numbers are lined up with the full SOW for just the ID numbers with a C2. Below would be the example result.
SOW Number
In Master Schedule?
1.0
No
1.1
No
1.1.1
Yes
1.1.2
No
1.1.3
No
3.0
No
3.2
No
3.3
No
3.5
No
3.6
No
3.6.1
No
3.6.1.2
Yes
4.0
No
5.0
Yes
5.1
No
5.2
No
6.0
Yes
The logic I'm trying to figure out with the formulas is:
If A# is in MS_Tab $G:$G, does the ID number start with a C2? If Yes, list "Yes" under "In MS?", else list "No"
I tried to do a VLOOKUP first and of course, that is incorrect since it only looks for the first instance of the search. Then I thought of doing a VLOOKUPpaired with an HLOOKUP, but that still falls into the same problem. I read I could do Index and Match, but I haven't been able to get the logic to work for me.
Note: I cannot change the ID's to make my life easier, this is using an excel export from our master schedule.

How to increase limit of 'decimal' field in expressionengine

I've got a Text Input field with 'Allowed Content' set to 'Decimal'. It won't let me set it to anything over a million on an entry, giving the error number_exceeds_limit.
I've thought about saving it as a string rather than use the decimal content type but I need to display them in order using orderby on the field and if it is a string it will treat 9 and being greater than 100 since 9 is greater than 1.
Is there a way to either increase or get around the million limit?
Expressionengine version 3.5.2 in case it's relevant.
You would need to edit the logic in cp/ee/EllisLab/Addons/text/ft.text.php (line 62 in 5.1.2) and also edit the column type in the DB structure (I just tried this locally setting the field length to 20,4 instead of 10,4.
It is probably worth raising an issue about this on the EE github as that limit seems restrictive to me (mySQL supports 65 digits). https://github.com/ExpressionEngine/ExpressionEngine/issues

Understanding Kusto

I am trying to understand Kusto (Log Analytics Query Language in Azure).
According to the documentation;
To retrieve , project name and resultsCode from the dependencies table, I need to enter the following:
dependencies
| project name, resultCode
The machines I have subscribed to do not have this table.
I am using the heartbeat table and trying to retrieve computer and category like so:
Heartbeat
| Category, Computer , IsGatewayInstalled
I however get the following error:
Query could not be parsed at 'Category' on line [2,2]
Token: Category Line: 2 Position: 2
This seems trivial and will appreciate any pointers on this.
the error you're getting is due to the fact there's no valid operator after the pipe (|), you should use the project operator before specifying the column names you want to retrieve

Datastage: String to Timestamp to milli seconds conversion

I'm trying to insert timestamp with milli seconds into a database. I tried following steps but haven't had any luck.
Extend field value to milli seconds , with length 26 and scale 3.
Used StringToTimestamp(timestampInString,"%yyyy-%mm-%dd %hh:%nn:%ss.3"), Resulting null value in output.
Modified the default time Stamp in job properties to %yyyy-%mm-%dd %hh:%nn:%ss.3
Design :
Sequential file --> TX --> destination (SQL/Seq file)
Could you please assist a solution for this?
What you tried looks good so far with one exception:
length 26 and scale 3
Using Db2 for example you would need to specify length 26 precision 6.
26 and 3 do not fit as
%yyyy-%mm-%dd %hh:%nn:%ss has length of 20
Specifying microsenonds is extended attriute is also necessary.
Have a try and provide more details of the target system if you still have problems
try below command in transformer stage and set the target data type as per the requirement, it will give the required result:
StringToTimestamp(Columnname,"%yyyy-%mm-%dd %hh:%nn:%ss.3")
Most important thing is to override the default NLS settings in the job with expected format (%yyyy-%mm-%dd %hh:%nn:%ss.3) which you have already completed.
Now, for the microseconds part which is not being displayed, you can enable the Microseconds extended attribute for the field in the target stage used.
Also you can refer this link from IBM which explains a similar scenario

SPFileVersionCollection - why versions are sorted in mixed order?

SPFileVersionCollection and SPListItemVersionCollection versioning seems inconsistent to me. Inconsistency wouldn't be a problem to me, but sort order is.
SPListItemVersionCollection
I can understand versioning of ListItems as they are stored in descending order:
SPContext.Current.ListItem.Versions.Count -> 5
SPContext.Current.ListItem.Versions[0].VersionId -> 1026 (2.2 latest version)
SPContext.Current.ListItem.Versions[1].VersionId -> 1025 (2.1)
SPContext.Current.ListItem.Versions[2].VersionId -> 1024 (2.0)
... [4].VersionId -> (oldest version)
SPFileVersionCollection
However I can't understand how version numbers are saved for a document library item:
SPContext.Current.ListItem.File.Versions.Count -> 4
SPContext.Current.ListItem.File.Versions[0].ID -> 512 (1.0 oldest one)
SPContext.Current.ListItem.File.Versions[1].ID -> 513 (1.1)
SPContext.Current.ListItem.File.Versions[2].ID -> 1025 (2.1 latest version)
SPContext.Current.ListItem.File.Versions[3].ID -> 1024 (2.0 (EDIT: IsCurrentVersion = True))
They are nor in ascending order, nor descending, but something mixed.
Is there any reason for SharePoint team to decide to store SPFile versions like that? And do they expect that I write my own method to get latest version or is there a builtin one for that?
A note: Let me point out that SPListItem.File is not null for document library items.
Thought I would output some info about SPFileVersionCollection in console app and it turns out that:
last index will hold the current (not
drafted but published) version
(SPFileVersion.IsCurrentVersion
property is TRUE for this)
0 index holds the oldest version
(last index - 1) has the last drafted version (for example 2.7) and (last index - 2) holds 2.6 etc.
SPFile.Versions.Count = 0 if you just uploaded brand new document (minor version, before publishing).
If you continue uploading new document versions and have not yet published one, then they add to SPFileVersionCollection, however none has IsCurrentVersion property set to true until you publish one.
Ahh, i had a false assumption that a last document draft version should count as the latest one. Ofcourse, the last PUBLISHED version is the latest one!
Still, beware of inconsistency.

Resources