nest

How do I map a single .NET type to multiple nested object types in ElasticSearch/NEST?

…衆ロ難τιáo~ 提交于 2019-12-01 02:28:14
I'm using the NEST library to interact with ElasticSearch, and I'm trying to figure out a way to build index types/nested objects based on non-type data. The type has the following basic structure. public class Entity : DynamicObject { public string Id { get; set; } // a bunch of other simple properties public override IEnumerable<string> GetDynamicMemberNames() { return Data.Select(x => x.Name); } public override bool TryGetMember(GetMemberBinder binder, out object result) { var dictionary = Data.First(x => x.Name == binder.Name); result = dictionary; return true; } // each instance of one

How to use POCOs with Fields in Elasticsearch.Net (NEST)?

帅比萌擦擦* 提交于 2019-12-01 00:24:12
How to I get a strongly-typed list of objects back when doing a search that uses Fields() ? For example: var searchResult = client.Search<Person>(s => s .Fields("title", "name") .Query(q => q.Match(...etc...) .Highlight(...etc...) ); It seems like the generic type parameter is useless when .Fields() is used because the Hits that are returned have a null .Source property. (I'm hoping there's a way to do it without having to manually map the search results back to my original Person POCO.) When you use fields parameter in your query, elasticsearch returns specified fields in fields section of

Elasticsearch using NEST: How to configure analyzers to find partial words?

喜你入骨 提交于 2019-11-30 22:37:58
I am trying to make a search by partial word, ignoring casing and ignoring the accentuation of some letters. Is it possible? I think ngram with default tokenizer should do the trick but i don't understand how to do it with NEST. Example: "musiic" should match records that have "music" The version I am using of Elasticsearch is 1.9. I am doing like this but it doesn't work... var ix = new IndexSettings(); ix.Add("analysis", @"{ 'index_analyzer' : { 'my_index_analyzer' : { 'type' : 'custom', 'tokenizer' : 'standard', 'filter' : ['lowercase', 'mynGram'] } }, 'search_analyzer' : { 'my_search

Returning Raw Json in ElasticSearch NEST query

落爺英雄遲暮 提交于 2019-11-30 20:21:07
I'm doing a small research about a client for elastic search in .net and I found that NEST is one of the most supported solutions for this matter. I was looking at Nest's docummentation and I couldn´t find a way to output a raw json from a query and avoid the serialization into an object, because I'm using angularJs in the front end I don´t want to overload the process of sending the information to the client with some unnecessary steps. ......and also I'd like to know how can I overrdide the serialization process? I found that NEST uses Json.NET which I would like to change for the

What is the alternative to QueryDescriptor nest 2.x

余生长醉 提交于 2019-11-30 18:56:44
问题 We are migrating our Nest 1.0 to NEST 2.0, In previous version we were having a query like this: container = new QueryContainer(); container = new QueryDescriptor<BaseModel>().Range(qs => qs.OnField(f => f.PublishedDate).LowerOrEquals(TimeZoneInfo.ConvertTimeToUtc(DateTime.Now))); if (!string.IsNullOrEmpty(contentType) && !contentType.ToLower().Equals("all")) { container &= new QueryDescriptor<BaseModel>().QueryString(qs => qs.OnFields(f => f.ContentType).Query(contentType)); } In NEST 2.0

Case insensitivity does not work

*爱你&永不变心* 提交于 2019-11-30 17:35:25
I cant figure out why my searches are case sensitive. Everything I've read says that ES is insensitive by default. I have mappings that specify the standard analyzer for indexing and search but it seems like some things are still case sensitive - ie, wildcard: "query": { "bool": { "must": [ { "wildcard": { "name": { "value": "Rae*" } } } ] } This fails but "rae*" works as wanted. I need to use wildcard for 'starts-with' type searches (I presume). I'm using NEST from a .Net app and am specifying the analyzers when I create the index thus: var settings = new IndexSettings(); settings

Elasticsearch - Autocomplete with NEST

你离开我真会死。 提交于 2019-11-30 17:25:19
问题 I'm trying to do autocomplete with the NEST client. The code looks as follows: Poco (condensed): public class Course { [ElasticProperty(Name="id")] public int ID { get; set; } public string Name { get; set; } [ElasticProperty(Type = FieldType.Completion)] public CompletionField Suggest { get; set; } public Course(sm.Models.Course c) { if (c != null) { this.ID = c.ID; this.Name = c.Name; this.Suggest = new CompletionField { Input = new List<string>(this.Name.Split(' ')) { this.Name }, Output =

[Nest] 初见nest

早过忘川 提交于 2019-11-30 16:29:13
nest 介绍 Nest 是一个用于构建高效,可扩展的 Node.js 服务器端应用程序的框架。它使用渐进式 JavaScript,内置并完全支持 TypeScript(但仍然允许开发人员使用纯 JavaScript 编写代码)并结合了 OOP(面向对象编程),FP(函数式编程)和 FRP(函数式响应编程)的元素。 在底层,Nest 使用强大的 HTTP Server 框架,如 Express(默认)和 Fastify。Nest 在这些框架之上提供了一定程度的抽象,同时也将其 API 直接暴露给开发人员。这样可以轻松使用每个平台的无数第三方模块。 设计哲学 近年来,感谢 Node.js,JavaScript 已成为前端和后端应用程序的网络“通用语言”。这产生了令人敬畏的项目,如 Angular,React 和 Vue,它们提高了开发人员的工作效率,并能够构建快速,可测试和可扩展的前端应用程序。然而,虽然 Node(和服务器端 JavaScript )存在大量优秀的库,帮助器和工具,但它们都没有有效地解决主要问题 - 架构。 Nest 提供了一个开箱即用的应用程序架构,允许开发人员和团队创建高度可测试,可扩展,松散耦合且易于维护的应用程序 环境搭建 您可以使用 Nest CLI 构建项目,也可以克隆启动项目(两者都会产生相同的结果)。 安装 cli npm i -g @nestjs

Elasticsearch/Nest - using MatchPhrase with OnFieldsWithBoost

假装没事ソ 提交于 2019-11-30 15:55:09
问题 In my code today I am doing a search like this: .Query(q => q.QueryString(qs => qs.Query(searchQuery).OnFieldsWithBoost(f => f.Add(b => b.MetaTitle, 5).Add(b => b.RawText, 1)))) My problem is this gives me a very wide search if I search on a phrase like. "The sun is shining". I have tried using MatchPhrase on RawText, instead of QueryString, and that kinda works. The problem is I still want to search in both MetaTitle and RawText and with the boosting I am using now. 回答1: I don't know Nest,

How can I use nested types with NEST client for Elastic Search

佐手、 提交于 2019-11-30 15:44:16
I ran in to some issues whilst trying to use statistical facets on my documents in Elastic Search. This resulted in the following posts on the Elastic Search google group - see https://groups.google.com/forum/#!topic/elasticsearch/wNjrnAC_KOY . I tried to apply the recommendation in the answer about using Nested types with in the document to provide distinct sums on the collections property(see https://groups.google.com/forum/#!topic/elasticsearch/wNjrnAC_KOY ) That is I would have many instances of MyType with a collection of MyItem. Some collections of MyItem will have instances with