Elasticsearch NEST 2 Upgrade Cheat Sheet (version 1.7 -> 2.0)

NEST version 2 official documentations:
 
NEST 1.7
NEST 2.0
.OnFields()
.Fields()
.OnField()
.Field()
.ConnectionStatus
.CallDetails
.ConnectionStatus.Request
.CallDetails.RequestBodyInBytes
 .Types(new[] {
     typeof(PageIndexObj),
     typeof(NewsIndexObj),
     typeof(PersonIndexObj)
   })
)
.Type("pageindexobj,newsindexobj,personindexobj")
OR
.Type(
  string.Join("," ,
     new[] {
        typeof(PageIndexObj),
        typeof(NewsIndexObj),
        typeof(PersonIndexObj)
     }.Select(t => t.Name.ToLower())
  )
)
OR
.AllTypes()
.SortAscending(o => o. Time)
.Sort(sd => sd.Ascending(o => o. Time))
.Search<T>(s => s
   .Filter(m => m
      .Term(t => t.Field(f => f.TypeId).Value(5)))
   )
)
Direct conversion:
.Search<T>(s => s
   .PostFilter(m => m
      .Term(t => t.Field(f => f.TypeId).Value(5)))
   )
) In most cases is better to use Query level filters: .Search<T>(s => s
   .Query(q => q
      .Bool(b => b
         .Filter(m => m
            .Term(t => t.Field(o => o.TypeId).Value(5))
         )
      )
   )
)
FilterContainer
QueryContainer
KeyValuePair<string, Highlight>
IHighlightHit
.Highlights.FirstOrDefault(kvp => kvp.Key == "name" )
o.Highlights["name"]
.MapFromAttributes()
.AutoMap()
.MapFromAttributes().IgnoreConflicts()
.AutoMap()
.PutTemplate()
.PutIndexTemplate().
.PutIndexTemplate( EsSettings .IndexNameBase + "-template" , t => t
  .Template(EsSettings.IndexNameBase + "*")
  .Settings(s => s
     .Add( "index.number_of_shards" , 1)
     .Add( "index.number_of_replicas" , 0)
  )
  . AddMapping <_default_ >(ms => ms.Dynamic (DynamicMappingOption.Ignore))
);
.PutIndexTemplate("my-index-template" , t => t
  .Template("my-index-name-prefix*")
  .Settings(s => s
     .NumberOfShards(1)
     .NumberOfReplicas(0)
  )
  .Mappings(mds => mds.Map< _default_>(s => s.Dynamic(DynamicMapping.Ignore)))
);
IElasticClient.Raw
IElasticClient.LowLevel
.Aggs.Terms("aggCategoryIds").Items
.Aggs.Terms("aggCategoryIds").Buckets
TermsAgregation.Items
TermsAgregation.Aggregations
.Greater(0)
.GreaterThan(0)
.LowerOrEquals(0)
.LessThanOrEquals(0)
.SuggestTerm()
.Suggest(s => s.Term())
  .OnFieldsWithBoost (d => d
     .Add (entry => entry.Name , 2)
  )
  .Fields(pf => pf
     .Field(entry => entry.Name, 2)
  )
 .ScriptScore(sc => sc.Script (SearchScoreScript))
.Functions(sc => sc.ScriptScore(sf => sf.Script(f => f.Inline(SearchScoreScript))))
.QueryString($"{query}*")
.Query(qc => qc.QueryString(q => q.Query($"{query}*")))
.AliasExists(aliasName).Exists
.AliasExists(s => s.Index(aliasName)).Exists
.CreateIndex(id => id.Index("index_name" ))
.CreateIndex( "index_name", id => id)
[ElasticProperty(Type = FieldType.String, Index = FieldIndexOption .NotAnalyzed)]
[ElasticProperty(Type = FieldType.Object)]
[ElasticProperty(Type = FieldType.Nested)]
[StringAttribute(Index = FieldIndexOption .NotAnalyzed)]
[ObjectAttribute()]
[Nested()]
[ElasticType()]
[ElasticsearchType()]
.Range()
.Range()
OR
.DateRange()
OR
.TermRange()
.DeleteByQuery()
NEST supports DeleteByQuery() OOTB, but elastic search requires Delete By Query -pluginSo the way to do it is with separate requests:
var deletedObjects =  elasticClient.Search<ObjectType>(i => i
   .AllTypes()
   .Query(f => f.Term(e => e.ContentId, contentId))
);
var deleteResults = deletedObjects .Hits.Select(h =>
     elasticClient.Delete(new DocumentPath<object>(h.Id).Type(h.Type), s => s)
);
.Filter(f => f.Terms(o => o. ContentId, items))
.Filter(f => f.Terms(t => t.Field(o => o.ContentId).Terms(items)))
.GetAliases()
.GetAlias()
.Facets()
.Aggregates()