nest

elastic search queries slow first time

假装没事ソ 提交于 2019-12-12 04:46:18
问题 At work I setup a dev environment on which we are testing elastic search for our ecommerce site. I noticed queries run extremely fast (compared to sql server). But, the first time the query is executed it takes quite some time to finally render products in the catalog. After initial query, everything starts working pretty fast. If I leave the site and re-enter some time after same thing happens. By the way our application is using NEST (high level c# client), and apparently for the first

Getting the request body of search response with 2.X NEST client

纵然是瞬间 提交于 2019-12-12 04:24:14
问题 I'm using the new 2.X NEST client. That part is important, because there were a great many breaking changes which will effect potential answers here. Previously, I used the Glimpse Elasticsearch plugin to see the underlying queries being generated by NEST. However, it would appear that that plugin is no longer compatible with 2.X NEST. As a result, I'm trying to find a workaround to see the JSON query. The problem here is that the old way of accessing response.RequestInformation to get at the

Dynamically add named mapping to Index

邮差的信 提交于 2019-12-12 04:23:45
问题 I would like to add mappings to an index after I've created it. I've created the index as such: client.CreateIndex("typeaheads", c => c .Settings(t => t.Analysis(m => m.TokenFilters(fl => fl.EdgeNGram("edge_ngram_filter", ad => ad.MinGram(2).MaxGram(20))) .Analyzers(anz => anz.Custom("edge_ngram_analyzer", an => an.Filters("lowercase", "edge_ngram_filter").Tokenizer("standard")))))); The variable typeName, is the name I want for the mapping. When I execute this: var map = new

How to use the Serialize method from the ElasticClient class from the NEST client in c#?

泪湿孤枕 提交于 2019-12-12 04:19:56
问题 I've created a successful connection to ES, and then written my json query. Now, I would like to send that query via the Serialize method. The Serialize method requires two parameters: 1. object and 2. Stream writableStream My question is, with the second one. When I create a stream with the following code line: Stream wstream; And use it to initialize my json2 variable with the following code: var json2 = highLevelclient.Serializer.Serialize(query, wstream).Utf8String(); I get the following

Set index.query.default_field using NEST Client c#

时光总嘲笑我的痴心妄想 提交于 2019-12-12 03:44:42
问题 I need to set index.query.default_field while creating index.How can I do it using Nest client c#. Added my create index code.Where do I set default_field property? var fullNameFilters = new List<string> { "lowercase", "snowball" }; client.CreateIndex("mydocs", c => c .Settings(st => st .Analysis(anl => anl .Analyzers(h => h .Custom("full", ff => ff .Filters(fullNameFilters) .Tokenizer("standard")) ) .TokenFilters(ba => ba .Snowball("snowball", sn => sn .Language(SnowballLanguage.English))) )

NEST 2.0 doesn't persist some fields into ElasticSearch 2.0

落花浮王杯 提交于 2019-12-12 03:36:44
问题 This is my document: [ElasticsearchType(Name = "MyDoc")] public class MyDoc: Dictionary<string, object> { [String(Store = false, Index = FieldIndexOption.NotAnalyzed)] public string text { get; set; } } As you can see, it inherits from Dictionary<string, object> so I can dinamically add fields to it (this is a requirement to make aggregation work) Here I store the mapping: client.Map<MyDoc>(m => m.Index("myindexname").AutoMap()); Now I create a new record and store it: var rec= new MyDoc();

nest for elasticsearch version 2.0.0.0 partial update on nested objects

左心房为你撑大大i 提交于 2019-12-12 03:13:25
问题 Say, I have some POCO like following. public class Graph { public string Id { get; set; } // Indexed by this public List<Node> NodeList { get; set; } } public class Node { public string Id { get; set; } public string Name { get; set; } public List<Edge> EdgeList { get; set; } } public class Edge { public string Id { get; set; } public double Cost { get; set; } } When partially updating my Graph I want to find an existing Node in NodeList by it's Id , and update it's Name and Edge property. I

ElasticSearch Nest 2.x Highlight Nested Object With _all Search

半城伤御伤魂 提交于 2019-12-12 01:54:35
问题 I can't seem to get nested objects to highlight when using an _all search. My index: { "settings":{ "analysis":{ "analyzer":{ "nGramAnalyzer":{ "type":"custom", "filter":[ "lowercase", "asciifolding", "NGramFilter" ], "tokenizer":"WhitespaceTokenizer" }, "WhitespaceAnalyzer":{ "type":"custom", "filter":[ "lowercase", "asciifolding" ], "tokenizer":"WhitespaceTokenizer" }, }, "filter":{ "NGramFilter":{ "type":"ngram", "min_gram":1, "max_gram":20 } }, "tokenizer":{ "WhitespaceTokenizer":{ "type"

SuggestCompletion Nest usage

爷,独闯天下 提交于 2019-12-12 01:47:41
问题 I'm trying to do a SuggestCompletion query for a location (countries and cities), I'd like to perform the query over those two fields. my mapping so far is the following: var response = _client.CreateIndex(PlatformConfiguration.LocationIndexName, descriptor => descriptor.AddMapping<LocationInfo>( m => m.Properties( p => p.Completion(s => s .Name(n=>n.CountryName) .IndexAnalyzer("simple") .SearchAnalyzer("simple") .MaxInputLength(50) .Payloads() .PreserveSeparators()

Unable to insert dynamic object to Elastic Search using NEST

我们两清 提交于 2019-12-12 00:35:45
问题 I am creating a dynamic object. I assign the values via IDictionary. Add the collections of the IDictionary to the object. Then I add the dynamic object to Elastic Search using NEST code. It throws me stackoverflow exception."An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" Here is what I have tried. var node = new Uri("http://localhost:9200"); var settings = new ConnectionSettings(node,defaultIndex: "test-index"); var client = new ElasticClient