nest

ElasticSearch NEST Query

左心房为你撑大大i 提交于 2019-11-28 09:29:35
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 not? You can find out what query NEST uses with the following code: var json = System.Text.Encoding

ElasticSearch Nest Insert/Update

空扰寡人 提交于 2019-11-28 08:42:56
I have created an index in elastic using the following query: PUT public_site { "mappings": { "page": { "properties": { "url": { "type": "string" }, "title":{ "type": "string" }, "body":{ "type": "string" }, "meta_description":{ "type": "string" }, "keywords":{ "type": "string" }, "category":{ "type": "string" }, "last_updated_date":{ "type": "date" }, "source_id":{ "type":"string" } } } } } I would like to insert a document into this index using the .net NEST library. My issue is that the .net update method's signature doesn't make any sense to me. client.Update<TDocument>(IUpdateRequest

ElasticSearch & attachment type (NEST C#)

帅比萌擦擦* 提交于 2019-11-28 08:37:59
I'm trying to index a pdf document with elasticsearch/NEST. The file is indexed but search results returns with 0 hits. I need the search result to return only the document Id and the highlight result (without the base64 content) Here is the code: I'll appreciate any help here, Thanks, class Program { static void Main(string[] args) { // create es client string index = "myindex"; var settings = new ConnectionSettings("localhost", 9200) .SetDefaultIndex(index); var es = new ElasticClient(settings); // delete index if any es.DeleteIndex(index); // index document string path = "test.pdf"; var doc

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

丶灬走出姿态 提交于 2019-11-28 04:37:22
问题 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

NEST: How to query against multiple indices and handle different subclasses (document types)?

耗尽温柔 提交于 2019-11-27 13:58:39
问题 I’m playing around with ElasticSearch in combination with NEST in my C# project. My use case includes several indices with different document types which I query separately so far. Now I wanna implement a global search function which queries against all existing indices, document types and score the result properly. So my question: How do I accomplish that by using NEST? Currently I’m using the function SetDefaultIndex but how can I define multiple indices? Maybe for a better understanding,

Index a dynamic object using NEST

佐手、 提交于 2019-11-27 13:25:50
问题 I am building an API application that essentially allows a user to build a document, which can be structured however they want, that will be stored in Elasticsearch. Essentially, I'm providing a simple interface for users to access our Elasticsearch instance. I'm trying to keep the implementation as simple as possible. Here's what I'm dealing with so far. The object for the expected body: public class DocumentModel { public string Index { get; set; } public string Type { get; set; } public

Filter items which array contains any of given values

被刻印的时光 ゝ 提交于 2019-11-27 09:44:28
问题 I have a set of documents like { tags:['a','b','c'] // ... a bunch properties } As stated in the title: Is there a way to filter all documents containing any of given tags using Nest ? For instance, the record above would match ['c','d'] Or should I build multiple "OR"s manually ? 回答1: Edit: The bitset stuff below is maybe an interesting read, but the answer itself is a bit dated. Some of this functionality is changing around in 2.x. Also Slawek points out in another answer that the terms

is there a way to deserialize Elasticsearch Nest search query?

孤街浪徒 提交于 2019-11-27 08:55:55
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":

Using InMemoryConnection to test ElasticSearch

大兔子大兔子 提交于 2019-11-27 07:13:39
问题 I'm trying to add testing around our use of ElasticSearch (in C# using Nest 1.4.2) and want to use InMemoryConnection but I'm missing something (I assume) and having no success. I've created this simple Nunit test case as a boiled down example of my issue using System; using Elasticsearch.Net.Connection; using FluentAssertions; using Nest; using NUnit.Framework; namespace NestTest { public class InMemoryConnections { public class TestThing { public string Stuff { get; } public TestThing

ElasticSearch & attachment type (NEST C#)

不羁岁月 提交于 2019-11-27 02:20:25
问题 I'm trying to index a pdf document with elasticsearch/NEST. The file is indexed but search results returns with 0 hits. I need the search result to return only the document Id and the highlight result (without the base64 content) Here is the code: I'll appreciate any help here, Thanks, class Program { static void Main(string[] args) { // create es client string index = "myindex"; var settings = new ConnectionSettings("localhost", 9200) .SetDefaultIndex(index); var es = new ElasticClient