nest

Elasticsearch .Net Client NEST使用说明 2.x

别来无恙 提交于 2019-12-19 00:18:41
Elasticsearch .net client NEST使用说明 目录: Elasticsearch .net client NEST 5.x 使用总结 elasticsearch_.net_client_nest2.x_到_5.x常用方法属性差异 Elasticsearch .net client NEST使用说明 2.x -更新版 Elasticsearch .Net Client NEST使用说明 2.x Elasticsearch.Net、NEST 交流群:523061899    demo源码 https://github.com/huhangfei/NestDemos Elasticsearch.Net与NEST是Elasticsearch为C#提供的一套客户端驱动,方便C#调用Elasticsearch服务接口。Elasticsearch.Net是对Elasticsearch服务接口较基层的的实现,NEST是在前者基础之上进行的封装,方法更简洁使用更方便。本文是针对NEST 2.X的使用的总结。 引用 引用dll NEST.dll Elasticsearch.Net.dll Newtonsoft.Json.dll 注:仅支持.net framework>=4.5 概念 存储结构: 在Elasticsearch中,文档(Document)归属于一种类型(type)

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

大兔子大兔子 提交于 2019-12-18 17:30:42
问题 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

ElasticSearch NEST client not returning results

允我心安 提交于 2019-12-18 12:28:30
问题 I am running a simple query through the ElasticSearch NEST C# client. I receive results when I run the same query through http, but I get zero documents returned from the client. This is how I populated the data set: curl -X POST "http://localhost:9200/blog/posts" -d @blog.json This POST request returns a JSON result: http://localhost:9200/_search?q=adipiscing This is the code I have that is not returning anything. public class Connector { private readonly ConnectionSettings _settings;

Serialising an object to JSON, and then using that to send a query in elastic search using NEST

走远了吗. 提交于 2019-12-18 09:25:40
问题 I get a bit confused and frustrated when it comes to using NEST to querying, as it seems very hit and miss. I have no trouble querying when using standard JSON, so I was wondering if there was some way to query using a JSON object, I have code below var query = "bkala"; var q = new { query = new { text = new { _all = "jane" } } }; var qJson = JsonConvert.SerializeObject(q); var hits = client.Search<Users>(qJson); However, I get the error "Cannot convert from type string to System.Func, Nest

Create custom token filter with NEST

落花浮王杯 提交于 2019-12-18 04:46:12
问题 How can I configure Index using NEST with such JSON: "settings":{ "analysis":{ "filter":{ "name_ngrams":{ "side":"front", "max_gram":50, "min_gram":2, "type":"edgeNGram" } }, "analyzer":{ "partial_name":{ "filter":[ "standard", "lowercase", "asciifolding", "name_ngrams" ], "type":"custom", "tokenizer":"standard" } } } I could create my custom analyzer using CustomAnalyzer class, but I could'n find how to create custom filter and register it within my analyzer. Thanks in advance! 回答1: After

How to disable camel casing Elasticsearch field names in NEST?

时光毁灭记忆、已成空白 提交于 2019-12-18 03:57:12
问题 By default, NEST will camel case object and property names when sending an object to Elasticsearch for indexing. How can camel casing field names be disabled in NEST for Elasticsearch documents? I've done a fair amount of research and there's a mailing list thread on the subject, but it seems outdated as some of the methods have been renamed or no longer exist. IConnectionPool connectionPool = new SniffingConnectionPool(m_ElasticsearchNodeUris); ConnectionSettings settings = new

Rename and Deleting Elasticsearch Indexes

放肆的年华 提交于 2019-12-17 20:54:29
问题 I'm using C# .NET application with NEST to create an index. I've created an elasticsearch index that customers can query called index_1. I then build another version of the index using a different instance of the application and call it index_1_temp. What is the safest way for me to rename index_1_temp to index_1 then delete the original index_1? I know ES has aliases but I'm not sure how to use them for this task EDIT: The original index does not have an Alias associated with it. 回答1: I

is there a way to deserialize Elasticsearch Nest search query?

时间秒杀一切 提交于 2019-12-17 09:49:32
问题 upon building my Elasticsearch query using Nest, i want to be able to see the JSON version of what's being sent to Elasticsearch. is this possible? some sort of deserializer i suppose. here's the info for my follow up question: { "_infer": { "defaultIndex": "myindex" }, "acknowledged": false, "isValid": false, "connectionStatus": { "success": false, "requestMethod": "POST", "requestUrl": "http://localhost:9200/myindex", "settings": {}, "request":

Setting not_analyzed for a property in Nest 5.5.0

萝らか妹 提交于 2019-12-14 03:46:01
问题 I have tried to set the "not_analyzed" index type via Nest 5.5.0 and I have no idea how to do it. My init: var map = new CreateIndexDescriptor(INDEX_NAME) .Mappings(ms => ms.Map<Project>(m => m.AutoMap())); var connectionSettings = new ConnectionSettings().DefaultIndex(INDEX_NAME); _client = new ElasticClient(connectionSettings); _client.Index(map); And the Project class: [ElasticsearchType(Name = "project")] public class Project { public Guid Id { get; set; } [Text(Analyzer = "not_analyzed")

Elasticsearch NEST library, wired behavior

£可爱£侵袭症+ 提交于 2019-12-14 03:20:36
问题 Using NEST .NET library I worte following query. var result = client.Search<StudenntBrief>(s => s.Type("Students").Query(q => q.Term("Name","Robert"))); It worked fine and got 7 results. Instead of using maigic string to represent field i tried to use expression as follows. var result = client.Search<StudenntBrief>(s => s.Type("Students").Query(q => q.Term(t => t.Name,"Robert"))); I found zero results. Here is one more example. Works. var result = client.Search<StudenntBrief>(s => s.Type(