For ease of explanation, lets consider the class below:
[ElasticType(Name = "blog")]
public class Blog
{
[ElasticProperty(Name = "id")]
public int Id { get; set; }
[ElasticProperty(Name = "title", Index = FieldIndexOption.No)]
public string Title { get; set; }
[ElasticProperty(OptOut = true)]
public string Comments { get; set; }
}
When you index an object of class Blog
, value of field Comments
is completely ignored. Simply put, Elasticsearch has no knowledge of the field Comments
. It is simply to be used by your client application maybe for some book-keeping purposes. The mapping definition of type blog
will be as under:
{
"mappings": {
"blog": {
"properties": {
"id": {
"type": "integer"
},
"title": {
"type": "string",
"index": "no"
}
}
}
}
}
Notice that title
field is present. If marked as Index = FieldIndexOption.No
, you cannot search for values in the title
field but you can certainly retrieve its value in the matching documents of a search request. Hope this answers your question.