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的更多相关文章

  1. 如何使用CREATE INDEX语句对表增加索引?

    创建和删除索引索引的创建可以在CREATE TABLE语句中进行,也可以单独用CREATE INDEX或ALTER TABLE来给表增加索引.删除索引可以利用ALTER TABLE或DROP INDE ...

  2. CREATE INDEX SELECT COUNT(*)

    CREATE INDEX windex_countrycode ON sales_rank (countrycode); CREATE INDEX windex_grab_amz_date ON sa ...

  3. PostgreSQL的 create index concurrently

    对于PostgreSQL的 "create index concurrently". 我个人认为其中存在一个bug. 我的验证过程如下: 我有两个表,tab01和 tab02,这两 ...

  4. linux之SQL语句简明教程---CREATE INDEX

    索引 (Index) 可以帮助我们从表格中快速地找到需要的资料.举例来说,假设我们要在一本园艺书中找如何种植青椒的讯息.若这本书没有索引的话,那我们是必须要从头开始读,直到我们找到有关种直青椒的地方为 ...

  5. SQL CREATE INDEX 语句

    CREATE INDEX 语句用于在表中创建索引. 在不读取整个表的情况下,索引使数据库应用程序可以更快地查找数据. 索引 您可以在表中创建索引,以便更加快速高效地查询数据. 用户无法看到索引,它们只 ...

  6. mysql 索引查询 、创建 create index 与 add index 的区别

    1.索引查询 ------TABLE_SCHEMA  库名:TABLE  表名 ------AND UPPER(INDEX_NAME) != 'PRIMARY'  只查询索引,不需要主键 SELECT ...

  7. 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/ ...

  8. Create Index语句的Include作用

    在 SQL Server 2005 中,可以通过将非键列添加到非聚集索引的叶级别来扩展非聚集索引的功能.通过包含非键列,可以创建覆盖更多查询的非聚集索引.这是因为非键列具有下列优点: 它们可以是不允许 ...

  9. create index 与 alter table add index 区别

    众所周知,MySQL创建索引有两种语法,即:ALTER TABLE HeadOfState ADD INDEX (LastName, FirstName);CREATE INDEX index_nam ...

随机推荐

  1. Kafka学习总结

    Kafka学习总结 参考资料: 1.http://kafka.apachecn.org/, kafka官方文档 2.https://www.cnblogs.com/likehua/p/3999538. ...

  2. linux qmake commend not found

    最近在学习Go语言,想要安装IDE liteide,在按这篇教程进行安装,当执行./build_linux.sh的时候,提示qmake commend not found的字眼,于是在网上搜,说出现这 ...

  3. python:dist-packages && site-packages

    先简单描述下问题.我用的ubuntu,源码编译安装的python3.我安装一些库,需要通过apt-get方式安装,这个时候就会遇到python找不到这些库的问题. 有个文章可以简单看看:http:// ...

  4. token的作用及实现原理

    1:首先,先了解一下request和session的区别request 指在一次请求的全过程中有效,即从http请求到服务器处理结束,返回响应的整个过程,存放在HttpServletRequest对象 ...

  5. Oracle 注意点大全

    1.索引 经常查询的字段.主表与从表关联主键id必须建立索引.

  6. YourKit Java Profiler安装和破解

    YourKit Java Profiler是业界领先的Java性能剖析工具.其独立版本安装成功且首次启动 YourKit Java Profiler 后,会弹出一个对话框,让用户选择 YourKit ...

  7. 1.oracle dblink(数据库不同实例数据对导)

    .创建一个两个数据库之间的dblink,语法如下 create database link to_test connect to scott identified by tiger using '(D ...

  8. xcconfig

    [xcconfig] 1.When you can use a .xcconfig file? Use .xcconfig files if you find yourself changing th ...

  9. centos下修改文件后如何保存退出

    centos下修改文件后如何保存退出 保存命令 按ESC键 跳到命令模式,然后: :w 保存文件但不退出vi :w file 将修改另外保存到file中,不退出vi :w! 强制保存,不推出vi :w ...

  10. (字符串 KMP)Blue Jeans -- POJ -- 3080:

    链接: http://poj.org/problem?id=3080 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88230#probl ...