Я пытаюсь выполнить индексацию определенных полей из класса POCO и декорирую некоторые свойства как "Ignore = true", и эти поля не должны индексироваться, но должны храниться. Я хочу, чтобы эти поля появлялись в результатах поиска, но не должны быть индексированными.
Я пытаюсь сопоставить несколько полей, которые должны быть проиндексированы, и игнорирую все остальные поля, для которых "Ignore = true" имеетдекоратор, предоставленный библиотекой Nest.
Вот пример класса POCO.
[PropertyName("doi")]
public string Doi { get; set; }
[PropertyName("displayName")]
public string DisplayName { get; set; }
[PropertyName("itemType")]
public string ItemType { get; set; }
[PropertyName("fileReference")]
public string FileReference { get; set; }
[PropertyName("textFirstPage", Ignore = true)]
public string TextFirstPage { get; set; }
[PropertyName("textLastPage", Ignore = true)]
public string TextLastPage { get; set; }
[PropertyName("citationTitle", Ignore = true)]
public string CitationTitle { get; set; }
[PropertyName("translatedPublicationTitle", Ignore = true)]
public string TranslatedPublicationTitle { get; set; }
[PropertyName("alternatePublicationTitle", Ignore = true)]
public string AlternatePublicationTitle { get; set; }
[PropertyName("publicationSubTitle", Ignore = true)]
public string PublicationSubTitle { get; set; }
Но все поля, которые были упомянуты в классе POCO, появляются в Mappingкогда я пытаюсь увидеть отображение индекса.
{
"cweeindex" : {
"mapping": {
"properties" : {
"doi": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"displayName": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"fileReference": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"itemType": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"citationTitle": {
"type": "boolean"
},
"publicationSubTitle": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"textFirstPage": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"textLastPage": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"translatedPublicationSubTitle": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"translatedPublicationTitle": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
}
}
}
}
ОБНОВЛЕНИЕ !! Код Nest для Mapping ниже
var createIndexResponse = _connectionToEs.EsClient().Indices.Create("cweeindex", c => c
.Map<EsStandardContract>(m => m.AutoMap())
);
Пожалуйста, дайте мне знать, что я делаю не так !! Заранее спасибо.