Skip to content

Instantly share code, notes, and snippets.

@davidlfox
Created September 8, 2014 19:45
Show Gist options
  • Save davidlfox/248d6a2e54a0f17f282f to your computer and use it in GitHub Desktop.
Save davidlfox/248d6a2e54a0f17f282f to your computer and use it in GitHub Desktop.
ES doc type with abstract classes?
[ElasticType(Name = "blsdata")]
public class SalaryDocument : IElasticSearchDocumentType<string>
{
public SalaryDocument()
{
}
/// <summary>
/// document id
/// </summary>
public string id { get; set; }
/// <summary>
/// State abbreviation
/// </summary>
[ElasticProperty(Name = "PRIM_STATE")]
public string State { get; set; }
/// <summary>
/// Geographical area name
/// </summary>
[ElasticProperty(Name = "AREA_NAME")]
public string AreaName { get; set; }
/// <summary>
/// Job title
/// </summary>
[ElasticProperty(Name = "OCC_TITLE")]
public string Title { get; set; }
/// <summary>
/// Type of salary information
/// </summary>
[ElasticProperty(Name = "OCC_GROUP")]
public string Type { get; set; }
/// <summary>
/// Annual salary info
/// </summary>
[ElasticProperty(Name = "A_MEAN")]
public int AnnualAverage { get; set; }
[ElasticProperty(Name = "A_MEDIAN")]
public int AnnualMedian { get; set; }
[ElasticProperty(Name = "A_PCT10")]
public int AnnualLow { get; set; }
[ElasticProperty(Name = "A_PCT25")]
public int AnnualFirstQuartile { get; set; }
[ElasticProperty(Name = "A_PCT75")]
public int AnnualThirdQuartile { get; set; }
[ElasticProperty(Name = "A_PCT90")]
public int AnnuarlHigh { get; set; }
//public AnnualSalary Annual { get; set; }
//public HourlySalary Hourly { get; set; }
/// <summary>
/// Hourly salary info
/// </summary>
[ElasticProperty(Name = "H_MEAN")]
public int HourlyAverage { get; set; }
[ElasticProperty(Name = "H_MEDIAN")]
public int HourlyMedian { get; set; }
[ElasticProperty(Name = "H_PCT10")]
public int HourlyLow { get; set; }
[ElasticProperty(Name = "H_PCT25")]
public int HourlyFirstQuartile { get; set; }
[ElasticProperty(Name = "H_PCT75")]
public int HourlyThirdQuartile { get; set; }
[ElasticProperty(Name = "H_PCT90")]
public int HourlyHigh { get; set; }
/// <summary>
/// Total employed in the area
/// </summary>
[ElasticProperty(Name = "TOTAL_EMP")]
public int TotalEmployed { get; set; }
/// <summary>
/// Number of these jobs per 1000 people employed in the area
/// </summary>
[ElasticProperty(Name = "JOBS_1000")]
public int JobsPer1000 { get; set; }
/// <summary>
/// A measurement of relative job quantity compared to the nation e.g.
/// 0.5 indicates less jobs of this type in this area than nationally
/// 1.0 indicates same ratio of jobs
/// 1.8 indicates many more jobs of this type in this area than nationally
/// </summary>
[ElasticProperty(Name = "LOC_QUOTIENT")]
public decimal LocationQuotient { get; set; }
}
public abstract class SalaryInfo
{
public int Average { get; set; }
public int Median { get; set; }
public int TenthPercentile { get; set; }
public int FirstQuartile { get; set; }
public int ThirdQuartile { get; set; }
public int NintiethPertentile { get; set; }
}
public class AnnualSalary : SalaryInfo
{
}
public class HourlySalary : SalaryInfo
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment