2
votes

I need to add a timestamp path to my index using NEST, not sure how to make this happen: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html

I have been messing with NEST but I cannot figure this out.

I have been reading the docs here but have not found what i am looking for: http://nest.azurewebsites.net/nest/quick-start.html

1

1 Answers

4
votes

Using the fluent API, this can be done when creating your index:

var response = client.CreateIndex("myindex", c => c
  .AddMapping<MyType>(m => m
    .MapFromAttributes()
    .TimestampField(t => t
      .SetDisabled(false)
      .SetPath(o => o.MyTimestampField)
    )
  )
);

Or updating an existing index:

var response = client.Map<MyType>(m => m
  .TimestampField(t => t
    .SetDisabled(false)
    .SetPath(o => o.MyTimestampField)
  )
);

Hope that helps.