Giter Site home page Giter Site logo

elasticsearch.net's Introduction

ElasticSearch.NET Client

License

Apache2

Requirements

version 0.16.0 or upper
thrift plugin enabled (non framed)

Features

Thrift supported
ConnectionPool Supported
Multi-Cluster Supported

Sample Project

ElasticSearch.DataManager
index relocate:reindex data from exist index(_source enabled)
index manage:bulk delete,quick data sample,search etc.

Tutorial

How to use

thrift config

in order to use thrift,you have to config to support cluster
first download the thrift-plugin
second edit the config/elasticsearch.yml with below:


thrift.port : 9500
thrift.protocol : ‘binary’

client config

edit the cluster config file:ElasticSearch.config
you can specify the cluster,and nodes,and also config the connection pool,and you can even specify the socket settings
here is simple example

<?xml version="1.0" encoding="utf-8"?>
<ElasticSearchConfig>  
  <Clusters>
    <Cluster Name="Prod">
      <TransportType>Thrift</TransportType>
      <ThriftNodes>
        <Node Host="127.0.0.1" Port="9500" Enabled="true" IsFramed="false" >         
        </Node>
      </ThriftNodes>      
    </Cluster>
    <Cluster Name="localhost">
      <TransportType>Http</TransportType>
      <HttpNodes>
        <Node Host="localhost" Port="9200" Enabled="true"  >          
        </Node>
      </HttpNodes>      
    </Cluster>
  </Clusters>  
</ElasticSearchConfig>

and now rock with elasticsearch.net


var client = new ElasticSearchClient(“localhost”);

CreateIndex:
client.CreateIndex(“index”, new IndexSetting(5, 1));

ModifyIndex:
client.ModifyIndex(index, new IndexSetting(10, 2));

DeleteIndex:
client.DeleteIndex(“index”);

CreateMapping:
var index = “index_operate” + Guid.NewGuid().ToString();
StringFieldSetting stringFieldSetting = new StringFieldSetting() { Analyzer = “standard”, Type = “string”, NullValue = “mystr” };

TypeSetting typeSetting = new TypeSetting(“custom_type”);
typeSetting.AddFieldSetting(“medcl”, stringFieldSetting);

var typeSetting2 = new TypeSetting(“hell_type1”);
var numfield = new NumberFieldSetting() { Store = Store.yes, NullValue = 0.00 };
typeSetting2.AddFieldSetting(“name”, numfield);

var result = client.PutMapping(index, typeSetting);

Index:
client.Index(“testindex”, “testtype”, “testkey”, “{\”a\“:\”b\“}”);
Search:
client.Search(“testindex”, “testtype”, “_id:testkey”);
Delete:
client.Delete(“testindex”, “testtype”, “testkey”);
Get:
client.Get(“testindex”, “testtype”, “testkey”);

check my tests for more example!

elasticsearch.net's People

Contributors

lonegunmanb avatar medcl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elasticsearch.net's Issues

Querying Geo locations

Hi, I was looking for a .net api to elastic search and found this project. I have a question though. I need to use geo location search for distance. How can I do that with this library?

Thanks for this library!

Jack

Version Exposed as an Int32 Type

While indexing documents into Elasticsearch, I can pass an external version with the document being indexed. The reason I want to do this is because I can get various versions of the same document in a span of few seconds or even quicker than that and there is no way I can control the order in which these versions get indexed.

To make sure the index always reflects latest state of the document, I thought I could use the last modified datetime stamp in the document, convert it to a sortable datetime integer (e.g. dateTime.ToString("yyyyMMddHHmmssFFF") gives me 20140427101814673) and pass it on to Elasticsearch as an external version when indexing a document.

Elasticsearch provides a very clean versioning capability that fits nicely into my requirement - the problem however is that Elasticsearch.NET limits this functionality by exposing version as an integer based type which cannot take the large numbers I am trying to pass.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.