This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample of Bulk functionality | |
var connection = new ElasticConnection("localhost", 9200); | |
var serializer = new JsonNetSerializer(); | |
var command = new BulkCommand(index: "myindex", type: "mytype"); | |
// MANUAL BULK CONSTRUCTION. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doc = new EsDocument(); // Some complex object that holds dictionary of runtime user-defined fields. | |
// doc.Fields = Dictionary<string, UserDefinedField>; | |
// where UserDefinedField.Name is equal to dictionary Key | |
// e.g. Fields["FName"] = new UserDefinedField{Name = "FName"}; | |
// and UserDefinedField.Attributes is user-defined attributes that controls mapping. | |
// and UserDefinedField.ContainsAttribute(attribute) returns true if such attribute set for this field. | |
// Here we define custom field mapping for each user-defined field in doc object. | |
var properties = new List<CustomPropertyMap>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class MongoSerializationExtensions | |
{ | |
public static BsonMemberMap PreserveValueIfNull(this BsonMemberMap memberMap) | |
{ | |
var originalSetter = memberMap.Setter; | |
Action<object, object> preserveSetter = (obj, value) => { | |
if (value != null) | |
originalSetter(obj, value); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using PlainElastic.Net; | |
using PlainElastic.Net.Queries; | |
using PlainElastic.Net.Serialization; | |
using PlainElastic.Net.Utils; | |
namespace PlainSample | |
{ | |
class User |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using PlainElastic.Net; | |
using PlainElastic.Net.Queries; | |
using PlainElastic.Net.Serialization; | |
using PlainElastic.Net.Utils; | |
namespace PlainSample | |
{ | |
class Program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using PlainElastic.Net; | |
using PlainElastic.Net.Queries; | |
using PlainElastic.Net.Serialization; | |
using PlainElastic.Net.Utils; | |
namespace FacetQuerySample | |
{ | |
class Item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using PlainElastic.Net; | |
using PlainElastic.Net.Mappings; | |
using PlainElastic.Net.Queries; | |
using PlainElastic.Net.Serialization; | |
using PlainElastic.Net.Utils; | |
namespace MappingSample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using PlainElastic.Net; | |
using PlainElastic.Net.IndexSettings; | |
namespace IndexSettigsSample | |
{ | |
class Program | |
{ | |
static void Main() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SearchResult<Tweet> searchResult = client.Search( | |
new SearchCommand("twitter", "tweet"), | |
new QueryBuilder<Tweet>() | |
.Query(q => q | |
.Term(t => t | |
.Field(tweet => tweet.User) | |
.Value("testUser") | |
.Boost(2) | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<!-- Commented out binding redirect. | |
<runtime> | |
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |
<dependentAssembly> | |
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | |
<bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.0.8.0" /> | |
</dependentAssembly> |
OlderNewer