I have the following property in a class:
public DateTime InsertedTimeStamp { get; set; }
With the the following mapping in ES
"insertedTimeStamp ":{
"type":"date",
"format":"yyyy-MM-ddTHH:mm:ssZ"
},
I would like to run an aggregation to return all the data grouped by the 'Day of the Week', i.e. 'Monday', 'Tuesday'...etc
I understand I can use a 'script' in the aggregation call to do this, see here, however, from my understanding, using a script has a not insignificant performance impact if there are alot of documents (which is anticpated here, think analytics logging).
Is there a way I can map the property with 'sub properties'. I.e. with a string I can do:
"somestring":{
"type":"string",
"analyzer":"full_word",
"fields":{
"partial":{
"search_analyzer":"full_word",
"analyzer":"partial_word",
"type":"string"
},
"partial_back":{
"search_analyzer":"full_word",
"analyzer":"partial_word_back",
"type":"string"
},
"partial_middle":{
"search_analyzer":"full_word",
"analyzer":"partial_word_name",
"type":"string"
}
}
},
All with the single property in the class in the .net
code.
Can I do something similar to store the 'full date' and then the 'year' and 'month' and 'day' etc separately (some sort of 'script' at index time), or will I need to make more properties in the class and map them individually? Is this what Transform did? (which is now depreciated hence seeming to indicate I need separate fields...)