Using the ecommerce data, I want to create a new field that is the total of products.taxful_price minus products.discount_amount (make it a double), then add the new field to a line graph using data from the past 7-days. I believe there should be 3-4 different ways to complete this task. Please share your approach. Cheers!
Hi @Yolanda.darricarrere Welcome to the community!
I am curious what your experience level is with The Elastic Stack. I ask because The formula / question you stated above is great! seems straight forward! etc... but with one exception....
The data fields you are referring to like
products.taxful_price are contained within Array Fields. In Elasticsearch arrays are challenging to work with from my experience, especially if you happen to be just getting started with elasticsearch. Perhaps that is the point!
You can see here they are in arrays ... that is what that means
So I am not quite sure if
A) you really want to deep dive into working with arrays in elasticsearch which is fine but non-trivial.
B) you just happen to pick the eCommerce sample data (which is what it is there for) and that data which seem cool / accessible but actually has some fairly complex data. (There are some other fields or sample data that you could work with that would be much easier to get started with)
if A) I would expect that you already have some familiarity with elasticsearch and the concepts of
fields, mappings, and perhaps painless scripting... etc., and I only see one solution with is a fully scripting / writing some non-trivial code which again is fine... just unclear if that is what you are looking for (perhaps I am missing something and someone else knows another way)
Basically it will involve be writing a small inline program looping through the array and doing the calculations you are looking for and producing the results... adding to the mapping / debugging it etc..
B) Perhaps start with some of the non-array fields to do a Runtime Field and / or Lens with formulas.
Which is what I think your topic is about ... Doing Formulas in Lens or Adding a simple Runtime Field ... which again is non-trivial with array fields...
Like calculate the average price per product working with these fields or sums or percent of total etc...
Let us know what your are after and perhaps someone can help.
Some great docs : This actually walks through a lot with the web logs data.
There is a lot good free training an blogs as well.
PS. Saw your other post, apologies I do not do tutoring, but there are a lot of good folks on this community perhaps one will reach out.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.