elasticsearch-net

Token Chars Mapping to Ngram Filter ElasticSearch NEST

守給你的承諾、 提交于 2021-02-04 19:17:05
问题 I'm trying to replicate the below mappings using NEST and facing an issue while mapping the token chars to the tokenizer. { "settings": { "analysis": { "filter": { "nGram_filter": { "type": "nGram", "min_gram": 2, "max_gram": 20, "token_chars": [ "letter", "digit", "punctuation", "symbol" ] } }, "analyzer": { "nGram_analyzer": { "type": "custom", "tokenizer": "whitespace", "filter": [ "lowercase", "asciifolding", "nGram_filter" ] } } } } I was able to replicate everything except the token

Elasticsearch.Net and Timeouts

不打扰是莪最后的温柔 提交于 2020-02-03 08:52:32
问题 I have a 4 node elasticsearch cluster. I have a .net console application that is designed to fill the cluster with data which comes from sql. Everything works fine as long as I keep the rate of records being added (or deleted) fairly low. If I increase the number of threads eventually I will see timeout errors from my console app. The cluster has a total of 48 cores and the average time it takes to index a record is about .1 seconds. I have been able to get it to do about 7000 records

Can't get any documents with NEST from elasticsearch

主宰稳场 提交于 2020-01-17 07:28:13
问题 I use Searchblox to index and search my files, which itself calls ES 2.x to do the job. Searchblox uses a "mapping.json" file to initialize a mapping upon the creation of an index. Here's the link to that file. As "@Russ Cam" suggested here, I created my own class content with the following code (just like he did with the "questions" index and "Question" class): public class Content { public string type { get; set; } public Fields fields { get; set; } } public class Fields { public Content1

Querying array of strings by array of strings in elasticsearch.net

痴心易碎 提交于 2019-12-31 05:14:29
问题 I'm using elasticsearch.net library in C# and I'm trying to query for objects matching specified filter. I would like the query to return objects where at least one of input names from filter exists in object's Names collection. The problem is that I always get 0 hits as result with this query, even tho I am certain that data matching specified filter does exist in the database and I would love to find out what's wrong with my query... The model: public class A { public int AId { get; set; }

Elasticsearch aggregation. Order by nested bucket doc_count

核能气质少年 提交于 2019-12-31 04:30:30
问题 What I want to achieve is aggregation by unique pairs (city, STATE). As per Elasticsearch documentation The terms aggregation does not support collecting terms from multiple fields in the same document . Thus I created a nested agg like this: { "size": 0, "aggs": { "cities": { "terms": { "field": "address.city", "size": 12 }, "aggs": { "states": { "terms": { "field": "address.stateOrProvince" }, "aggs": { "topCity": { "top_hits": { "size": 1, "sort": [ { "price.value": { "order": "desc" }}]}}

ElasticSearch NEST Query

北城以北 提交于 2019-12-28 13:56:52
问题 I'm trying to mimic a query that I wrote in Sense (chrome plugin) using NEST in C#. I can't figure out what the difference between the two queries is. The Sense query returns records while the nest query does not. The queries are as follows: var searchResults = client.Search<File>(s => s.Query(q => q.Term(p => p.fileContents, "int"))); and { "query": { "term": { "fileContents": { "value": "int" } } } What is the difference between these two queries? Why would one return records and the other

Elastic search with GUID ID without attributes

∥☆過路亽.° 提交于 2019-12-25 09:17:11
问题 We are looking to switch from a relational database to elastic search and I am trying to get some basic code up and running with Nest. We have existing objects which use guids for ids that I would like to save into an elastic search index. I don't want to add any specific attributes as the class is used in different applications and I don't want to add unnecessary dependencies to Nest. Right now my code looks like this: var node = new Uri("http://localhost:9200"); var settings = new

Searching Date Field value in ElasticSearch without time

核能气质少年 提交于 2019-12-23 09:34:32
问题 I have one date field in my data as "type": "date", "format": "dateOptionalTime" Now My date Field and Value is - "INITIAL_EXTRACT_DATE" : "2015-04-02T06:47:57.78+05:30" While searching I am searching based on only date that is "2015-04-02". but I am getting 0 result. Can anyone suggest how to search exact date and is any of date. Now I am trying with this - For Exact Date - "term": { "IH_PT_DSC": { "value": "2015-04-02" } } For Is any of date - "terms": { "IH_PT_DSC": [ "2015-04-02", "2015

“Clone” index mappings

女生的网名这么多〃 提交于 2019-12-13 20:27:35
问题 I have an index which I will be reindexing. At the moment I want to create a new index, which should contain the exact same mappings that can be found in the original index. I've got this: var srcMappings = client.GetMapping(new GetMappingRequest((Indices)sourceIndexName)).Mappings; And I try to create an index: var response = client.CreateIndex(destinationIndex, c => c .Settings(...my settings ...) .Mappings(... what here? ...) ); What exactly should I pass to the .Mappings(...) above so

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