0
我们有一个社交应用程序,其中用户可以按照某种特定categories.User会有用户教育,认证,位置等 我要搜索用户位置的基础上,教育等类似的搜索根据类别分组。我想使用Elasticsearch映射社会关系elasticsearch
这是用户映射
"userData" : { "dynamic" : "true", "properties" : { "allSuggest" : { "type" : "completion", "analyzer" : "simple", "payloads" : true, "preserve_separators" : true, "preserve_position_increments" : true, "max_input_length" : 50 }, "email" : { "type" : "string", "index" : "not_analyzed" }, "firstName" : { "type" : "string" }, "gender" : { "type" : "object", "enabled" : false }, "id" : { "type" : "string" }, "isActive" : { "type" : "string", "index" : "not_analyzed" }, "lastName" : { "type" : "string" }, "location" : { "properties" : { "country" : { "type" : "string", "index" : "not_analyzed" }, "region" : { "type" : "string" } } }, "mId" : { "type" : "object", "enabled" : false }, "profilePic" : { "type" : "object", "enabled" : false }, "profileStatus" : { "type" : "object", "enabled" : false }, "status" : { "type" : "object", "enabled" : false }, "userId" : { "type" : "object", "enabled" : false }, "userSuggest" : { "type" : "completion", "analyzer" : "simple", "payloads" : true, "preserve_separators" : true, "preserve_position_increments" : true, "max_input_length" : 50 } } }
组模型
"groupData" : { "dynamic" : "true", "properties" : { "allSuggest" : { "type" : "completion", "analyzer" : "simple", "payloads" : true, "preserve_separators" : true, "preserve_position_increments" : true, "max_input_length" : 50 }, "cDate" : { "type" : "object", "enabled" : false }, "categoryId" : { "type" : "integer" }, "groupId" : { "type" : "object", "enabled" : false }, "groupName" : { "type" : "string" }, "groupPic" : { "type" : "object", "enabled" : false }, "groupStatus" : { "type" : "object", "enabled" : false }, "groupSuggest" : { "type" : "completion", "analyzer" : "simple", "payloads" : true, "preserve_separators" : true, "preserve_position_increments" : true, "max_input_length" : 50 }, "isActive" : { "type" : "string", "index" : "not_analyzed" }, "mId" : { "type" : "object", "enabled" : false } } }
的问题是,我怎么能说用户是该组的成员。在一个特定的群体
搜索成员应该我添加与用户数据本身作为嵌套或父子的教育细节。
还是很难处理Elasticsearch中的社会关系?
为了过滤组ids我必须索引它们或保留为not_analyzed,如果我添加很多索引的细节,那么它会导致任何问题。我的意思是索引的大小会影响性能 –
你可以把group_ids作为一个数组在用户映射中。这将需要一些额外的空间,但你需要与性能交易空间。空间的差异不会像其公正的ID一样。索引的大小并不影响你的用例的性能,但是如果你的索引变得很大,那么你将不得不为这些东西保留不同的索引,我认为你永远不需要索引。我一直在使用ES来索引约100 GB的数据,而没有任何性能问题。 –