nest

Nest and elastic search- update mapping for nested object?

被刻印的时光 ゝ 提交于 2019-12-11 10:27:08
问题 I am trying to add a new property to an existing nested document. My document looks like: "mappings": { "test": { "_routing": { "required": true, "path": "tId" }, "properties": { "series": { "type": "nested", "properties": { "iType": { "type": "string", "index": "not_analyzed", "doc_values": true }, "isValid": { "type": "boolean" }, }, }, } } The property i want to insert to nested document "series" is "iType". How can i use the NEST put mapping API to update the existing mapping? Any help

Updating a property of an object in a list in ElasticSearch document?

别等时光非礼了梦想. 提交于 2019-12-11 10:02:47
问题 I'm fairly new to ElasticSearch. I'm using it in a .NET project and I'm using NEST client. Right now I'm examining ways of handling document updates. I have a document that looks like this: public class Class1 { public string Prop1 { get; set; } public string Prop2 { get; set; } public List<Class2> PropList { get; set; } } and when I want to add something to the PropList, I'm doing it by script: client.Update<Class1>(x => x .Id(1) .Index("index_name") .Script("ctx._source.propList += prop")

Elasticsearch Date Histogram report with Terms aggregation

荒凉一梦 提交于 2019-12-11 08:57:52
问题 I'm trying Nest plugin for querying elastic search data. I have a yearly job count report based on a field. Currently I have used the date Histogram report for this and below is the elastic query. POST insight/_search { "size": "0", "query": { "filtered": { "query": { "query_string": { "query": "(onet.familycode: 11)" } } } }, "aggregations": { "jobcounts_by_year": { "date_histogram": { "field": "jobdate", "interval": "year", "format": "yyyy" }, "aggregations": { "count_by_occupation_family":

How to create Fluent DSL lambda expression for below json

橙三吉。 提交于 2019-12-11 07:46:38
问题 I have json where i have multiple model and variant for car and now we need to dynamically create the query as per request for car model with associated variant. I have json below. I tried to create the query but don't know how i will handle dynamically multiple model and variant request. var response = _esclient.EsClient().Search<ClassName>(a => a .Index("Test") .Type("Testa") .Query(q => q.Bool(b => b.Must(m => m.Bool(p => p.Should(should => should.Bool(sb => sb.Must(m3 => m3.Term(t => t

Does NEST support updating index analysis?

对着背影说爱祢 提交于 2019-12-11 06:46:25
问题 As written in the elasticSearch documentation here, it's possible to define a new analysis for an index (I tried and it worked fine). I was wondering if it was possible to perform the same thing with NEST? I tried this: ElasticClient.CloseIndex("myindex"); IndexSettings ndxSettings = ElasticClient.GetIndexSettings("myindex").Settings; ndxSettings.Analysis.Analyzers.Add("snbowball", new SnowballAnalyzer()); var r = ElasticClient.UpdateSettings("myindex", ndxSettings); ElasticClient.OpenIndex(

Nest ignoring my percolate query property

岁酱吖の 提交于 2019-12-11 06:31:17
问题 I'm indexing a type that has percolate query but Nest/elasticsearch choose to ignore the query property. public class MyQueryModel { public string Id { get; set; } public string UserId { get; set;} public string Email { get ; set;} public string Name { get; set; } public string State { get; set; } public QueryContainer PercolatedQuery { get; set; } } public class DocModel { public string Id { get; set; } public string Title { get; set; } public string State { get; set; } public string

Specify the _id field using Bulk.IndexMany in ElasticSearch

独自空忆成欢 提交于 2019-12-11 06:06:26
问题 I'm facing a problem inserting document using bulk API (C# NEST v5.4). I've an array of documents and inside of the array I've my ID. My code is: documents = documents .ToArray(); Client.Bulk(bd => bd.IndexMany(documents, (descriptor, s) => descriptor.Index(indexName))); How can i insert the _id manually using the descriptor ? Thanks in advance! 回答1: You can set _id similarly to how you're setting the index name on the BulkDescriptor . Given the following POCO public class Message { public

Nest 2.x - Custom JsonConverter

心已入冬 提交于 2019-12-11 05:14:58
问题 I want to use the IsoDateTimeConverter from Newtonsoft to format the json version of my DateTime properties. However, I cant figure out how this is done in Nest 2.x. Here is my code: var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200")); var settings = new ConnectionSettings(connectionPool, s => new MyJsonNetSerializer(s)); var client = new ElasticClient(settings); public class MyJsonNetSerializer : JsonNetSerializer { public MyJsonNetSerializer

Are ElasticClient.MapRaw and .CreateIndexRaw gone?

南楼画角 提交于 2019-12-11 05:04:51
问题 After updating to NEST 0.11.5, it appears as if the NEST.ElasticClient.MapRaw and .CreateIndexRaw methods aren't supported anymore. Have they been renamed or moved or are they completely gone? In case they're gone, how can I define custom analysis settings on index creation? This is what I've tried: var indexSettings = new IndexSettings() { NumberOfReplicas = 1, NumberOfShards = 2, Analysis = new AnalysisSettings() // doesn't work, no setter { // here's where my settings would go... } }; var

Elasticsearch / NEST 6 - storing enums as string

三世轮回 提交于 2019-12-11 04:05:42
问题 Is it possible to store enums as string in NEST6? I've tried this but it does not seem to work. Any suggestions? var pool = new SingleNodeConnectionPool(new Uri(context.ConnectionString)); connectionSettings = new ConnectionSettings(pool, connection, SourceSerializer()); private static ConnectionSettings.SourceSerializerFactory SourceSerializer() { return (builtin, settings) => new JsonNetSerializer(builtin, settings, () => new JsonSerializerSettings { Converters = new List<JsonConverter> {