私はネストに問題があります。私はElasticsearch 5.1.1に全く新しいインデックスを持っており、私はdotnetコアでタイプマッピングを定義しようとしています。同じタイプを2回マッピングするネスト
私のクラスはそのようになります。私のアプリケーションで
public class Review
{
public Guid Id { get; set; }
public User User { get; set; }
public Movie Movie { get; set; }
public int Grade { get; set; }
public string Title { get; set; }
public string Comment { get; set; }
public bool HasSpoiler { get; set; }
public bool BoughtInIngresso { get; set; }
public ReviewStatus Status { get; set; }
public DateTime Date { get; set; }
}
public class User
{
public string Id { get; set; }
public string Name { get; set; }
}
public class Movie
{
public string Id { get; set; }
public string Name { get; set; }
}
、私はそのように(単なるテスト用)タイプマッピングの短い形式を定義しようとしています。新しい
VARプール= StaticConnectionPool(ノード);
var settings = new ConnectionSettings(pool);
settings.DefaultIndex(elasticSettings.IndexName);
var client = new ElasticClient(settings);
client.Map<Review>(m =>
m.Index("my_index")
.Type("reviews")
.Properties(ps=>
ps.Keyword(k=>
k.Name("title"))
.Text(t=>
t.Name("comment"))
)
);
これが最終結果です。作成されたレビューとレビューのマッピングを観察します。私は "レビュー"ではなく "レビュー"を望んでいます。
{
"my_index": {
"mappings": {
"reviews": {
"properties": {
"comment": {
"type": "text"
},
"title": {
"type": "keyword"
}
}
},
"review": {
"properties": {
"boughtInSite": {
"type": "boolean"
},
"comment": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"date": {
"type": "date"
},
"grade": {
"type": "long"
},
"hasSpoiler": {
"type": "boolean"
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"movie": {
"properties": {
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"status": {
"type": "long"
},
"title": {
"type": "keyword"
},
"user": {
"properties": {
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
}
}
私は間違っていますか?これはAutoMap()を使用すると起こります。私はPOCOのクラスを保存したいので属性とマッピングしたくないのですが、それが唯一の方法だったら私はできます。
いくつかお手伝いしますか?