Skip to content

Instantly share code, notes, and snippets.

@alecslupu
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alecslupu/168c0f62f948d633378b to your computer and use it in GitHub Desktop.
Save alecslupu/168c0f62f948d633378b to your computer and use it in GitHub Desktop.
Dummy object relation
{
"users": {
"mappings": {
"user": {
"properties": {
"user_forum_daily_stats": {
"type": "nested",
"include_in_parent": true,
"properties": {
"forum_id": {
"type": "string"
},
"comment_count": {
"type": "string"
},
"thread_count": {
"type": "string"
},
"stat_date": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"user_forums": {
"type": "nested",
"include_in_parent": true,
"properties": {
"forum_id": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"created_at": {
"type": "date",
"format": "dateOptionalTime"
},
"is_certified": {
"type": "boolean"
},
"login": {
"type": "string",
"analyzer": "snowball"
},
"name": {
"type": "string",
"analyzer": "snowball"
},
"sites": {
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"unique_code": {
"type": "string",
"analyzer": "snowball"
}
}
}
}
}
}
class User
attribute :login
atrribute :name
attribute :some_other_field
has_many :sites
has_many :relations
end
class Site
attribute :url
attribute :description
attribute :name
end
class UserForums
belongs_to :user
belongs_to :forum
end
class Forum
attribute :name
attribute :description
some_other_fields
end
class UserFroumDailyStats
belongs_to :user
belongs_to :forum
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment