nest

How to search inside multiple indices using Nest ElasticSearch?

人盡茶涼 提交于 2019-12-10 10:20:01
问题 I have two indices with the following mapping(I will shortcut their mappings): 1) AccountType mapping: elasticClient.CreateIndex("account", i => i .Settings(s => s .NumberOfShards(2) .NumberOfReplicas(0) ) .Mappings(m => m .Map<AccountType>(map => map .AutoMap() .Properties(p => p .Text(c => c .Name(n => n.Name) .Analyzer("standard") ) .Text(c => c .Name(n => n.Description) .Analyzer("standard") ) ) ) ) ); 2) ProductType mapping: elasticClient.CreateIndex("proudct", i => i .Settings(s => s

load specific fields in Elasticsearch Nest query

 ̄綄美尐妖づ 提交于 2019-12-10 09:43:40
问题 the documentation seems to indicate i can return a subset of fields instead of the entire document. here's my code: var result = client.Search<MyObject>(s => s .Fields(f => f.Title) .Query(q => q .QueryString(qs => qs .OnField("title") .Query("the")))); i'm searching on the word 'the' on the 'title' field and wanting to just return 'title'. my result.Documents object contains 10 objects that are each null. i do see the values i want but it's deep in the search response: result.Hits[0].Fields

Delete a document from ElasticSearch index by id

ⅰ亾dé卋堺 提交于 2019-12-10 08:29:37
问题 I have a document in elastic search. I am trying to implement a method where I can specify a string id to delete a document from the index using NEST client. This is the indexed doc that I want to delete: "hits":[{"_index":"movies","_type":"list","_id":"100","_score":0.6349302, "_source" : { "owner": "Bob", "tags": "Bobita", "title": "Movie clips of Bob" }} This is my C# code which doesn't delete the doc. It says id is NULL. Uri localhost = new Uri("http://localhost:9200"); var setting = new

Multi Terms search NEST C#

丶灬走出姿态 提交于 2019-12-10 03:22:29
问题 I want to do a search matching multiple values ( an array of values ) like this : var result1 = _client.Search<type1>(s => s .Fields(f => f.trip_id) .Query(q => q .Terms(t => t.arg1, value1)).Take(_allData)) .Documents.Select(d => d.arg2).ToArray(); var result2 = _client.Search<type2>(s => s .Query(q => q .Terms(t => t.arg3, result1)) .Take(_allData) ).Documents.Select(s => s.ar3).ToList(); How can I do ? I was thinking about facets but I don't see how I can do it. The only way for now that

Matching a complete complex nested collection item instead of separate members with Elastic Search

好久不见. 提交于 2019-12-09 23:55:48
问题 I have an index with a nested collection of items I want to hit. A collection item contains multiple properties that all have to match a certain query, not just any of them. Here's the model: public class IndexEntry1 { public IEnumerable<NestedType1> NestedProperty1 { get; set; } } public class NestedType1 { public string Member1 { get; set; } public string Member2 { get; set; } } So I want to hit only documents that have a specific combination of Member1 and Member2 values in the IndexEntry1

KMP

☆樱花仙子☆ 提交于 2019-12-09 16:33:08
详细讲解 例题 #include<bits/stdc++.h> using namespace std; string a,b; int nest[1000005]; int m,n; void q_next() { int k=0; for(int i=2; i<=n; i++) { while(k>0&&b[i]!=b[k+1]) k=nest[k]; if(b[i]==b[k+1]) k++; nest[i]=k; } } int main() { cin>>a; cin>>b; m=a.length(); n=b.length(); a=' '+a; b=' '+b; q_next(); int k=1; for(int i=1; i<=m; i++) { while(k>0&&a[i]!=b[k+1]) k=nest[k]; if(a[i]==b[k+1]) k++; if(k==n) { cout<<i-n+1<<"\n"; k=nest[k]; } } for(int i=1; i<=n; i++) cout<<nest[i]<<" "; return 0; } 来源: https://www.cnblogs.com/mxy2004/p/12011771.html

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

这一生的挚爱 提交于 2019-12-09 02:19:51
问题 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 =

Nest ElasticSearch: Boolean Search using Nested Query and Nested Objects

大憨熊 提交于 2019-12-08 12:50:26
问题 I am using Nest Elastic and building the query for a Boolean search using Head plugin , i am combining multiple queries Notes about DB Structure and Elastic Mapping Each document in the database is linked to specific profileId which in turn has multiple attributes Each document has multiple attribute values associated with it In this query, i am trying to get all documents which has specific profile and attribute value > 30 keeping in mind that this attribute should have the attribute Id 2

Copying a nested property to parent object in elasticsearch with Nest client

血红的双手。 提交于 2019-12-08 12:21:07
问题 How can I copy a nested property into a field of the containing POCO in an index mapping definition? I am able to successfully copy a property into another property with .CopyTo when both fields are at the same object level. However I am struggling with copying a property on a nested object into a property on the parent object. Given the objects below, I would like to copy 'Street' from the Address property on a Person into the 'Search' property on Person Person { public string Search { get;

AddSortField in nest 2 upgrade

冷暖自知 提交于 2019-12-08 11:19:04
问题 I used to use the add-sort-field=true as an attribute to a property, but with the new nest I can't find the equivalent. Where is it? Thanks. 回答1: Looks like it has been accidently removed from NEST 2.x. I couldn't find any trace why. Feel free to ask this question if you think it was useful in your case. Link to the NEST github. As far I as I understand, property was creating fieldname.sort field which was not_analyzed . For time being you can handle this by explicit creating field.