Create Index using NEST .NET
Hello Guys,
I have a doubt about how create index using NEST .NET. I created every fields in my C# method, however when i'll see the json created in elasticsearch the _all field doesn't exists. Follow below the method, it's created the type in elasticsearch and the json got on elasticsearch. May someone help me, please?
C# Method(Partial Fields)
private void CreateMappings()
{
_client.Map(descriptor =>
{
descriptor.Index(DefaultIndexName);
descriptor.Properties(propertiesDescriptor =>
{
propertiesDescriptor.Number(prod => prod.Name(produto => produto.id).Index(true).Type(NumberType.Long).IncludeInAll(true));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.id_Migracao).Index(true).Type(NumberType.Short).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.id_Loja).Index(true).Type(NumberType.Short).IncludeInAll(false));
propertiesDescriptor.Text(prod => prod.Name(produto => produto.ds_Produto).IncludeInAll(true).Analyzer("brazilian").Fields(mf => mf.Text(vl => vl.Name(f => f.ds_Produto.Suffix("original")).IncludeInAll(false).Index(false))));
propertiesDescriptor.Text(prod => prod.Name(produto => produto.cd_Produto).Index(true).IncludeInAll(true).Analyzer("brazilian"));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.id_Fabricante).Index(true).Type(NumberType.Integer).IncludeInAll(false));
propertiesDescriptor.Text(prod => prod.Name(produto => produto.ds_Fabricante).Index(true).IncludeInAll(true).Analyzer("brazilian").Fields(mf => mf.Text(vl => vl.Name(f => f.ds_Produto.Suffix("original")).IncludeInAll(false).Index(false))));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.vr_Avaliacao).Index(true).Type(NumberType.Short).IncludeInAll(false));
propertiesDescriptor.Boolean(prod => prod.Name(produto => produto.is_Disponivel).Index(true));
propertiesDescriptor.Boolean(prod => prod.Name(produto => produto.is_Oferta).Index(true));
propertiesDescriptor.Boolean(prod => prod.Name(produto => produto.is_ExibirSempre).Index(true));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.qt_Disponivel).Index(true).Type(NumberType.Integer).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.qt_Vendido).Index(true).Type(NumberType.Integer).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.id_Promocao).Index(true).Type(NumberType.Long).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.vr_PrecoPor).Index(true).Type(NumberType.Double).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.vr_PrecoDe).Index(true).Type(NumberType.Double).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.qt_Parcelas).Index(true).Type(NumberType.Short).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.vr_Parcelas).Index(true).Type(NumberType.Double).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.qt_ParcelasSemJuros).Index(true).Type(NumberType.Short).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.vr_ParcelasSemJuros).Index(true).Type(NumberType.Double).IncludeInAll(false));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.vr_TaxaJuros).Index(true).Type(NumberType.Double).IncludeInAll(false));
propertiesDescriptor.Text(prod => prod.Name(produto => produto.ds_hierarquia_categoria).Index(false).IncludeInAll(false));
propertiesDescriptor.Boolean(prod => prod.Name(produto => produto.is_FotoRotativa).Index(true));
propertiesDescriptor.Number(prod => prod.Name(produto => produto.qtd_rotativa).Index(true).Type(NumberType.Integer).IncludeInAll(false));
propertiesDescriptor.Boolean(prod => prod.Name(produto => produto.is_Disponibilidade).Index(true));
propertiesDescriptor.Text(prod => prod.Name(produto => produto.guid_transacao).Index(true).IncludeInAll(false).Analyzer("brazilian"));
return propertiesDescriptor;
});
return descriptor;
});
}
JSON(Partial fields)
{
"fernando_v02": {
"mappings": {
"produtos": {
"properties": {
"cd_Produto": {
"type": "text",
"analyzer": "brazilian",
"include_in_all": true
},
"ds_Fabricante": {
"type": "text",
"fields": {
"original": {
"type": "text",
"index": false,
"include_in_all": false
}
},
"analyzer": "brazilian",
"include_in_all": true
},
"ds_Produto": {
"type": "text",
"fields": {
"original": {
"type": "text",
"index": false,
"include_in_all": false
}
},
"analyzer": "brazilian",
"include_in_all": true
},
"ds_UrlImagem": {
"type": "text",
"index": false,
"include_in_all": false
},
"ds_hierarquia_categoria": {
"type": "text",
"index": false,
"include_in_all": false
},
"dt_Lancamento": {
"type": "date",
"include_in_all": false
},
"guid_transacao": {
"type": "text",
"analyzer": "brazilian",
"include_in_all": false
},
"id": {
"type": "long",
"include_in_all": true
},....
....
}
}
Create Index using NEST .NET的更多相关文章
- 如何使用CREATE INDEX语句对表增加索引?
创建和删除索引索引的创建可以在CREATE TABLE语句中进行,也可以单独用CREATE INDEX或ALTER TABLE来给表增加索引.删除索引可以利用ALTER TABLE或DROP INDE ...
- CREATE INDEX SELECT COUNT(*)
CREATE INDEX windex_countrycode ON sales_rank (countrycode); CREATE INDEX windex_grab_amz_date ON sa ...
- PostgreSQL的 create index concurrently
对于PostgreSQL的 "create index concurrently". 我个人认为其中存在一个bug. 我的验证过程如下: 我有两个表,tab01和 tab02,这两 ...
- linux之SQL语句简明教程---CREATE INDEX
索引 (Index) 可以帮助我们从表格中快速地找到需要的资料.举例来说,假设我们要在一本园艺书中找如何种植青椒的讯息.若这本书没有索引的话,那我们是必须要从头开始读,直到我们找到有关种直青椒的地方为 ...
- SQL CREATE INDEX 语句
CREATE INDEX 语句用于在表中创建索引. 在不读取整个表的情况下,索引使数据库应用程序可以更快地查找数据. 索引 您可以在表中创建索引,以便更加快速高效地查询数据. 用户无法看到索引,它们只 ...
- mysql 索引查询 、创建 create index 与 add index 的区别
1.索引查询 ------TABLE_SCHEMA 库名:TABLE 表名 ------AND UPPER(INDEX_NAME) != 'PRIMARY' 只查询索引,不需要主键 SELECT ...
- How MySQL Uses Indexes CREATE INDEX SELECT COUNT(*)
MySQL :: MySQL 5.7 Reference Manual :: 9.3.1 How MySQL Uses Indexeshttps://dev.mysql.com/doc/refman/ ...
- Create Index语句的Include作用
在 SQL Server 2005 中,可以通过将非键列添加到非聚集索引的叶级别来扩展非聚集索引的功能.通过包含非键列,可以创建覆盖更多查询的非聚集索引.这是因为非键列具有下列优点: 它们可以是不允许 ...
- create index 与 alter table add index 区别
众所周知,MySQL创建索引有两种语法,即:ALTER TABLE HeadOfState ADD INDEX (LastName, FirstName);CREATE INDEX index_nam ...
随机推荐
- 解决no-session延迟加载问题
解决no-session延迟加载问题 说明:dao层使用Hibernate从数据库查询数据信息返回给web层,在web层打印信息报no-Session错误, 产生原因 关联对象默认都是采用延迟加载 事 ...
- AUC,KS,ROC
要弄明白ks值和auc值的关系首先要弄懂roc曲线和ks曲线是怎么画出来的.其实从某个角度上来讲ROC曲线和KS曲线是一回事,只是横纵坐标的取法不同而已.拿逻辑回归举例,模型训练完成之后每个样本都会得 ...
- Ubuntu下用devstack单节点部署Openstack
一.实验环境 本实验是在Vmware Workstation下创建的单台Ubuntu服务器版系统中,利用devstack部署的Openstack Pike版. 宿主机:win10 1803 8G内存 ...
- Axure 原型图 (转)
Axure RP是很有名的一个界面原型设计工具,可以灵活快捷的对C/S.B/S程序设计原型. 近期我要开发一个Android客户端,也打算使用Axure RP设计原型. 下载地址:http://pan ...
- 22.Generate Parentheses (String; Back-Track)
Given n pairs of parentheses, write a function to generate all combinations of well-formed parenthes ...
- 使用SQL查询所有数据库名和表名
使用SQL查询所有数据库名和表名 MySQL中查询所有数据库名和表名 查询所有数据库 show databases; 1 1 查询指定数据库中所有表名 select table_name from i ...
- Draw Call(Unity 5中显示为SetPass calls
Draw Call(Unity 5中显示为SetPass calls
- zookeeper的ZAB协议
ZAB协议概述 ZooKeeper并没有完全采用Paxos算法,而是使用了一种称为ZooKeeper Atomic Broadcast(ZAB,zookeeper原子消息广播协议)的协议作为其数据一致 ...
- thinkphp 调用wsdl接口实例化SoapClient抛出异常
异常:Message:SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://*****?wsdl' : failed to load externa ...
- EBS R12 Vision Profile default value - IRC: Geocode Host
Profile Option Name Site Application Responsibility Server Server Org User IRC: Geocode Host http:// ...