I am trying to do indexing of certain fields from POCO class and decorating some of the properties as "Ignore = true" and those fields should not be indexed but should be stored. I want those fields to appear in the search result but should not be index.
I am trying to do the mapping of few fields which should be indexed and ignoring all the other fields that have "Ignore = true" as the decorator provided by Nest Library.
Here is the example of the of the POCO class.
[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; }
But all the fields that have been mentioned in the POCO class is appearing in the Mapping when I try to see the Mapping of the Index.
{
"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
}
}
},
}
}
}
}
UPDATE!! The Nest code for Mapping is below
var createIndexResponse = _connectionToEs.EsClient().Indices.Create("cweeindex", c => c
.Map<EsStandardContract>(m => m.AutoMap())
);
Please, let me what am I doing wrong!! Thanks in Advance.