nest

Elastic Search using NEST Field Boosting

旧巷老猫 提交于 2019-11-30 05:10:32
I am using Elastic Search in C# using the NEST strongly typed client. I have an index containing Entries: [ElasticType(Name = "Entry", IdProperty = "Id")] public class Entry { public string Id { get; set; } public string Title { get; set; } public string Description { get; set; } public string Award { get; set; } public int Year { get; set; } } Where Year is the year of the entry, eg 2012, and Award is the type of Award the Entry won, which can be null. I then want to search these Entries using boosting for different properties. In the following code, I want results to be ranked higher that

Sorting on Multiple Fields

岁酱吖の 提交于 2019-11-30 04:44:16
问题 Does Nest support sorting on multiple fields? For example, say I want to sort first by FieldA ascending and then by FieldB descending. My current approach looks something like this: searchDescriptor.Sort(s =>s.OnField("FieldA").Ascending().OnField("FieldB").Descending()); But the "FieldB".Descending() part seems to be the only sort option that is sent to elasticsearch. Does anyone know if there is another way to accomplish this? 回答1: You are adding multiple fields on the same sort descriptor,

Case insensitivity does not work

走远了吗. 提交于 2019-11-30 01:06:14
问题 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

How to update an Elasticsearch document in NEST2

不想你离开。 提交于 2019-11-29 22:49:38
问题 I have ported my code to NEST 2.0 and Elasticsearch 2.0 I need to find a way to update a document already stored into ES2 I was using the partial object technique: elastic.Update<myDocumentType, myPartialDocumentType>(u => u .Index(myIndexName) .Id(id) .Doc( new myPartialDocumentType() { // set the fields to update here }) .Refresh()); How to do the same thing using NEST2? 回答1: The way how you are passing document id changed a bit. Looks like follow today: var updateResponse = client.Update

Need concrete documentation / examples of building complex index using NEST ElasticSearch library

巧了我就是萌 提交于 2019-11-29 20:35:34
问题 I would like to use the NEST library's Fluent interface to create an index, which involves setting up custom filters, analyzers, and type mappings. I would like to avoid decorating my classes with NEST-specific annotations. I have seen the documentation at http://nest.azurewebsites.net/indices/create-indices.html and http://nest.azurewebsites.net/indices/put-mapping.html. This documentation, while showing some examples, is not complete enough to help me figure out how to use the Fluent API to

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

余生长醉 提交于 2019-11-29 17:18:07
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.ISearchRequest" If anyone knows how I can simply query using a JSON object, that would be fantastic,

Elasticsearch bulk insert with NEST returns es_rejected_execution_exception

天大地大妈咪最大 提交于 2019-11-29 16:31:12
I am trying to do bulk insert using .Net API in Elasticsearch and this is the error that I am getting while performing the operation; Error {Type: es_rejected_execution_exception Reason: "rejected execution of org.elasticsearch.transport.TransportService$6@604b47a4 on EsThreadPoolExecutor[bulk, queue capacity = 50, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@51f4f734[Running, pool size = 4, active threads = 4, queued tasks = 50, completed tasks = 164]]" CausedBy: ""} Nest.BulkError Is it due to the low space in my system or the bulk insert function itself is not working? My

Using Elasticsearch.Net/NEST to search parent documents based on child attributes, where parent/child documents are stored separately

别来无恙 提交于 2019-11-29 16:10:11
问题 I would like to use Elasticsearch.Net/NEST to search related documents. For example, I have: Person: id name address_id -- ---- ---------- 1 John 1 2 Mary 2 Address: id city -- ------ 1 Boston 2 Berlin I'd like to store the Person and Address documents separately, and do queries where I return Person documents based on Address fields. For example, return all documents for people living in Boston. I've seen some examples in the Elaticsearch documentation using mapping and parent/child

Elastic Search-Search string having spaces and special characters in it using C#

孤者浪人 提交于 2019-11-29 10:50:55
I am looking for ElasticSearch nest query which will provide exact match on string having spaces in it using C#. for example - I want to search for a word like 'XYZ Company Solutions'. I tried querystring query but it gives me all the records irrespective of search result. Also i read on the post and found that we have to add some mappings for the field. I tried 'Not_Analyzed' analyzer on the field but still it does not worked. Here is my code of C# var indexDefinition = new RootObjectMapping { Properties = new Dictionary<PropertyNameMarker, IElasticType>(), Name = elastic_newindexname }; var

Creating an index Nest

两盒软妹~` 提交于 2019-11-29 10:02:19
How would I recreate the following index using Elasticsearch Nest API? Here is the json for the index including the mapping: { "settings": { "analysis": { "filter": { "trigrams_filter": { "type": "ngram", "min_gram": 3, "max_gram": 3 } }, "analyzer": { "trigrams": { "type": "custom", "tokenizer": "standard", "filter": [ "lowercase", "trigrams_filter" ] } } } }, "mappings": { "data": { "_all" : {"enabled" : true}, "properties": { "text": { "type": "string", "analyzer": "trigrams" } } } } } Here is my attempt: var newIndex = client.CreateIndexAsync(indexName, index => index .NumberOfReplicas