nest

ElasticSearch - Add element inside nested List<T> using NEST 5.x

偶尔善良 提交于 2019-12-11 03:49:02
问题 I have a list inside my ElasticSearch index. How can i add a new element to the list using NEST 2? I have already searched an answer to my problem, but all that i found are answer for the version 1.x, and it doesn't work for me. MODEL: public class TicketModel { public Guid Id { get; set; } public Guid IdUser { get; set; } public Guid IdAuthor { get; set; } public Guid? IdAssignedUser { get; set; } public Guid? IdAsset { get; set; } public Guid? IdOwner { get; set; } public DateTime

Elasticsearch.NET NEST Object Initializer syntax for a highlight request

心不动则不痛 提交于 2019-12-11 03:07:55
问题 I've got: var result = _client.Search<ElasticFilm>(new SearchRequest("blaindex", "blatype") { From = 0, Size = 100, Query = titleQuery || pdfQuery, Source = new SourceFilter { Include = new [] { Property.Path<ElasticFilm>(p => p.Url), Property.Path<ElasticFilm>(p => p.Title), Property.Path<ElasticFilm>(p => p.Language), Property.Path<ElasticFilm>(p => p.Details), Property.Path<ElasticFilm>(p => p.Id) } }, Timeout = "20000" }); And I'm trying to add a highlighter filter but I'm not that

Nest Elastic - Building Dynamic Nested Query

女生的网名这么多〃 提交于 2019-12-10 17:55:03
问题 I have to query a nested object using Nest, however the query is built in dynamic way. Below is code that demonstrate using query on nested "books" in a static way QueryContainer qry; qry = new QueryStringQuery() { DefaultField = "name", DefaultOperator = Operator.And, Query = "salman" }; QueryContainer qry1 = null; qry1 = new RangeQuery() // used to search for range ( from , to) { Field = "modified", GreaterThanOrEqualTo = Convert.ToDateTime("21/12/2015").ToString("dd/MM/yyyy"), };

NEST (elasticsearch) Highlighting in multiple fields

别等时光非礼了梦想. 提交于 2019-12-10 13:49:41
问题 I have successfully obtained results and highlights using Nest but if I include two fields in which to search for highlights it only uses the last one in construction of the elasticsearch query. e.g. the following .Query(qry => qry .QueryString(qs => qs .Query(qString) ) ) .Highlight(h => h .PreTags("<b>") .PostTags("</b>") .OnFields(f => f .OnField("Title") .OnField("Summary") ) ) means that I only get highlights returned from the "Summary" field. If I query elasticsearch directly with the

How to insert 4 million records from Oracle to Elasticsearch table faster using C#?

℡╲_俬逩灬. 提交于 2019-12-10 13:49:19
问题 I have the following code written in C# but according to that, it would take me 4-5 days to migrate the data from Oracle database to Elasticsearch. I am inserting the records in batches of 100. Is there any other way that the migration of the 4 million records takes place faster (probably in less than a day, if possible)? public static void Selection() { for(int i = 1; i < 4000000; i += 1000) { for(int j = i; j < (i+1000); j += 100) { OracleCommand cmd = new OracleCommand(BuildQuery(j),

Elasticsearch search query to retrieve all records NEST

六月ゝ 毕业季﹏ 提交于 2019-12-10 13:12:53
问题 I have few documents in a folder and I want to check if all the documents in this folder are indexed or not. To do so, for each document name in the folder, I would like to run through a loop for the documents indexed in ES and compare. So I want to retrieve all the documents. There are few other possible duplicates of the same question like retrieve all records in a (ElasticSearch) NEST query and enter link description here but they didnt help me as the documentation has changed from that

Multithreading within a thread lock

笑着哭i 提交于 2019-12-10 12:16:41
问题 I am working on speeding up the execution of some processes that publish a bulk set of records (Mostly in the millions) to Elasticsearch. In my C# code I have already implemented a multi-threaded solution using Dataflow as scaffolded below: var fetchRecords = new TransformBlock<?, ?>(() => { ... }); var sendRecordsToElastic = new ActionBlock<List<?>>(records => sendBulkRequest(records)); fetchRecords.LinkTo(sendRecordsToElastic, { PropogateCompletion = true }); fetchRecords.Post("Start"); And

How can i search multiple indices with ElasticSeach (C#/NEST)?

北城以北 提交于 2019-12-10 11:53:04
问题 I creat this function: public static ISearchResponse<Immo> searchImmoByCustomerField(Nest.ElasticClient esClient, string esIndex, string esIndex2, int from, int take, string qField, string nmqField, string qTerm, string nmqTerm) { var result = esClient.Search<Immo>(s => s .AllIndices() .Query(q => q .Indices(i => i .Indices(new[] { esIndex, esIndex2 }) .Query(iq => iq.Term(qField, qTerm)) .NoMatchQuery(iq => iq.Term(nmqField, nmqTerm)) ) ) ); return result; } The function looking in 2 Indices

Elasticsearch Nest and CopyTo

我怕爱的太早我们不能终老 提交于 2019-12-10 11:34:41
问题 Has anyone located or used a CopyTo attribute in Nest? I can see it's been added as part of the fluent mapping but can't seem to find it as an attribute which is how I am carrying out all my mapping currently. 回答1: Attribute-based mapping in NEST doesn't support CopyTo . You need to use the fluent API. See my comment here for an explanation. 来源: https://stackoverflow.com/questions/26873551/elasticsearch-nest-and-copyto

Elastic Search 5.x Nest Multiple Queries C#

有些话、适合烂在心里 提交于 2019-12-10 11:22:04
问题 I'm using C# with those nuget packeges; <package id="Elasticsearch.Net" version="5.2.0" targetFramework="net462" /> <package id="NEST" version="5.2.0" targetFramework="net462" /> <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net462" /> What I want to do here, I want to get "white" items in price range 2000 - 3000. It's a simple request for a search api, am I right ? So I wrote a code for this. Here it is; private static void Search(IElasticContext elasticContext, string