我对elasticsearch nest 2.x客户端存在问题
我有一个这样的模型:
public class ProductPrice
{
public string ProductImagePath { get; set; }
public string VideoPath { get; set; }
public bool ProfitRateIsSet { get; set; }
public decimal? ProfitRate { get; set; }
public decimal TLPrice { get; set; }
public string SearchKey { get; set; }
}
我写了这段代码,
var node = new Uri("http://localhost:9200");
var settings = new ConnectionSettings(node);
settings.PrettyJson(true);
var client = new ElasticClient(settings);
var createIndexDescriptor = new CreateIndexDescriptor("product-price")
.Mappings(ms => ms
.Map<ProductPrice>(m => m.AutoMap())
);
var response = client.CreateIndex(createIndexDescriptor);
var request2 = client.Search<ProductPrice>(s => s
.Index(ElasticConnect.Constants.Index.PRODUCT_PRICE)
.Type(ElasticConnect.Constants.Type.COUCHBASE_DOCUMENT)
.From(0)
.Size(10)
.Query(q => q
.Term("productID", "210068468")
)
);
搜索是成功查找产品,但productprice模型属性始终为null。
我在哪里做错了?