Elasticsearch Nest,父/子关系

时间:2013-10-11 19:50:35

标签: elasticsearch nest

你可以帮助我使用NESTclient为弹性搜索定义父/子关系吗? 我的代码看起来像这样:

[ElasticType(Name = "type_properties", DateDetection = true,.....)]
public class Properties{....}

[ElasticType(Name = "type_sales", DateDetection = true, , ParentType = "type_properties")]
public class SalesHistory{....}

我定义了parentType,但是我没有看到这个销售文档与父属性相关。

{
  "_index": "testparentchild",
  "_type": "type_sales",
  "_id": "dVd1tUJ0SNyoiSer7sNA",
  "_version": 1,
  "_score": 1,
  "_source": {
    "salesRecId": 179504762,
    "salesPrice": 150000,
    "salesDate": "2003-04-07T00:00:00",
  }
}

1 个答案:

答案 0 :(得分:-1)

不推荐使用基于属性的映射,因为无法以这种方式表达所有可能的映射可能性。

请参阅 https://github.com/elasticsearch/elasticsearch-net/blob/master/src/Tests/Nest.Tests.Unit/Core/Map/FluentMappingFullExampleTests.cs

如何为您的类型正确应用映射。

相关问题