我正在使用Olivere的v.5 elasticsearch库- https://godoc.org/github.com/olivere/elastic </ p>

尝试检查是否 文档中存在特定字段。 根据ES文档,有可能- https://www.elastic.co/guide/zh-CN/elasticsearch/reference/current/query-dsl-exists-query.html </ p>

但我找不到 在库中执行查询。 我找到了NewExistsService,但没有看到按字段名称搜索的方法。 我需要类似</ p>

  elasticClient.Exists()。Field(“ datefield”)
</ code> </ pre>

之类的东西,它们返回true 或错误。 但是,“字段”不是“ NewExistsService”的方法。 任何帮助将不胜感激。</ p>
</ div>



I'm using olivere's v.5 elasticsearch library - https://godoc.org/github.com/olivere/elastic

Trying to check if a particular field exists in a document. According to ES docs, it's possible - https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-exists-query.html

But I can't find a Go query in the library to execute that. I found the NewExistsService but I don't see a method to search by field name. I need something like


which returns true or false. But 'Field' is not a method of 'NewExistsService'. Any help would be appreciated.

dongtang9855 您是否知道如何执行此操作?
2 年多之前 回复
drrkgbm6851 然后只需获取文档并检查字段即可。如果文档太大,则可以使用StoreFields忽略所有其他字段。假设的elasticClient.Exists()。Field(“datefield”)不能工作,因为它没有指定文档ID。
2 年多之前 回复
dongmi4734 我想我应该已经指定了,我在寻找文档中是否存在字段,而不是索引。
2 年多之前 回复
duanjiu3486 但是,这甚至还不是您链接的文档中的ElasticAPI如何工作的方式。对于该链接页面,它“返回在原始字段中至少具有一个非空值的文档”。它不会根据索引中是否存在字段来返回true或false-鉴于Elastic是无模式的,这在Elastic中仍然是一个奇怪的问题。
2 年多之前 回复
Csdn user default icon

<div class="post-text" itemprop="text"> <p>I am writing a function in golang to search for a string in elasticsearch documents which are indexed. I am using elasticsearch golang client <a href="https://github.com/olivere/elastic" rel="nofollow">elastic</a>. For example consider the object is tweet,</p> <pre><code>type Tweet struct { User string Message string Retweets int } </code></pre> <p>And the search function is </p> <pre><code>func SearchProject() error{ // Search with a term query termQuery := elastic.NewTermQuery("user", "olivere") searchResult, err := client.Search(). Index("twitter"). // search in index "twitter" Query(&amp;termQuery). // specify the query Sort("user", true). // sort by "user" field, ascending From(0).Size(10). // take documents 0-9 Pretty(true). // pretty print request and response JSON Do() // execute if err != nil { // Handle error panic(err) return err } // searchResult is of type SearchResult and returns hits, suggestions, // and all kinds of other information from Elasticsearch. fmt.Printf("Query took %d milliseconds ", searchResult.TookInMillis) // Each is a convenience function that iterates over hits in a search result. // It makes sure you don't need to check for nil values in the response. // However, it ignores errors in serialization. If you want full control // over iterating the hits, see below. var ttyp Tweet for _, item := range searchResult.Each(reflect.TypeOf(ttyp)) { t := item.(Tweet) fmt.Printf("Tweet by %s: %s ", t.User, t.Message) } // TotalHits is another convenience function that works even when something goes wrong. fmt.Printf("Found a total of %d tweets ", searchResult.TotalHits()) // Here's how you iterate through results with full control over each step. if searchResult.Hits != nil { fmt.Printf("Found a total of %d tweets ", searchResult.Hits.TotalHits) // Iterate through results for _, hit := range searchResult.Hits.Hits { // hit.Index contains the name of the index // Deserialize hit.Source into a Tweet (could also be just a map[string]interface{}). var t Tweet err := json.Unmarshal(*hit.Source, &amp;t) if err != nil { // Deserialization failed } // Work with tweet fmt.Printf("Tweet by %s: %s ", t.User, t.Message) } } else { // No hits fmt.Print("Found no tweets ") } return nil } </code></pre> <p>This search is printing tweets by the user 'olivere'. But if I give 'olive' then search is not working. How do I search for a string which is part of User/Message/Retweets?</p> <p>And the Indexing function looks like this,</p> <pre><code>func IndexProject(p *objects.ElasticProject) error { // Index a tweet (using JSON serialization) tweet1 := `{"user" : "olivere", "message" : "It's a Raggy Waltz"}` put1, err := client.Index(). Index("twitter"). Type("tweet"). Id("1"). BodyJson(tweet1). Do() if err != nil { // Handle error panic(err) return err } fmt.Printf("Indexed tweet %s to index %s, type %s ", put1.Id, put1.Index, put1.Type) return nil } </code></pre> <p><strong>Output:</strong></p> <pre><code>Indexed tweet 1 to index twitter, type tweet Got document 1 in version 1 from index twitter, type tweet Query took 4 milliseconds Tweet by olivere: It's a Raggy Waltz Found a total of 1 tweets Found a total of 1 tweets Tweet by olivere: It's a Raggy Waltz </code></pre> <p><strong>Version</strong></p> <pre><code>Go 1.4.2 Elasticsearch-1.4.4 </code></pre> <p><strong>Elasticsearch Go Library</strong></p> <pre><code>github.com/olivere/elastic </code></pre> <p>Could anyone help me on this.? Thank you</p> </div>


<div class="post-text" itemprop="text"> <p>I'm trying to use a scriptfield to calculate the subtotal (hours * price) in the DocumentResponse struct. It works fine without the scriptfield.</p> <p>It's all based on this example <a href="https://outcrawl.com/go-elastic-search-service/" rel="nofollow noreferrer">https://outcrawl.com/go-elastic-search-service/</a></p> <p>Don't be surprised if it's a very simple mistake I'm completely new to coding.</p> <p>My guess is that something goes wrong when unmarshaling the response.</p> <p>These are the structs in question:</p> <pre><code>type DocumentResponse struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` Project string `json:"project"` Hours float64 `json:"hours"` Date string `json:"date"` Price float64 `json:"price"` Vat float64 `json:"vat"` Subtotal float64 `json:"subtotal"` } type SearchResponse struct { Time string `json:"time"` Hits string `json:"hits"` Documents []DocumentResponse `json:"documents"` } </code></pre> <p>This is where I try to search and return the struct with the scriptfield included:</p> <pre><code> boolQ := elastic.NewMatchAllQuery() subtotal := elastic.NewScriptField("doc['subtotal'].value", elastic.NewScript("doc['price'].value * doc['hours'].value")) src := elastic.NewSearchSource().Query(boolQ).ScriptFields(subtotal) result, err := elasticClient.Search(). Index(elasticIndexName). SearchSource(src). From(skip).Size(take). Do(c.Request.Context()) if err != nil { log.Println(err) errorResponse(c, http.StatusInternalServerError, "Something went wrong") return } res := SearchResponse{ Time: fmt.Sprintf("%d", result.TookInMillis), Hits: fmt.Sprintf("%d", result.Hits.TotalHits), } // Transform search results before returning them docs := make([]DocumentResponse, 0) for _, hit := range result.Hits.Hits { var doc DocumentResponse json.Unmarshal(*hit.Source, &amp;doc) docs = append(docs, doc) } res.Documents = docs c.JSON(http.StatusOK, res) } </code></pre> <p>Running something like this:</p> <pre><code>curl 'localhost:8080/search?start=2018-04-01&amp;end=2018-04-30&amp;project=bogus' </code></pre> <p>Does not return anything and generates an error:</p> <pre><code>2018/05/01 13:20:42 [Recovery] panic recovered: GET /search?start=2018-04-01&amp;end=2018-04-30&amp;project=bogus HTTP/1.1 Host: localhost:8080 Accept: */* User-Agent: curl/7.59.0 runtime error: invalid memory address or nil pointer dereference /usr/lib/go/src/runtime/panic.go:502 (0x42ac98) gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz)) /usr/lib/go/src/runtime/panic.go:63 (0x429d0d) panicmem: panic(memoryError) /usr/lib/go/src/runtime/signal_unix.go:388 (0x43fa49) sigpanic: panicmem() /home/niklas/go/src/git.enokinetwork.com/niklas/goest/main.go:168 (0x9bf56a) searchEndpoint: json.Unmarshal(*hit.Source, &amp;doc) /home/niklas/go/src/github.com/gin-gonic/gin/context.go:110 (0x8ad492) (*Context).Next: c.handlers[c.index](c) /home/niklas/go/src/github.com/gin-gonic/gin/recovery.go:46 (0x8bd369) RecoveryWithWriter.func1: c.Next() /home/niklas/go/src/github.com/gin-gonic/gin/context.go:110 (0x8ad492) (*Context).Next: c.handlers[c.index](c) /home/niklas/go/src/github.com/gin-gonic/gin/logger.go:83 (0x8bc69b) LoggerWithWriter.func1: c.Next() /home/niklas/go/src/github.com/gin-gonic/gin/context.go:110 (0x8ad492) (*Context).Next: c.handlers[c.index](c) /home/niklas/go/src/github.com/gin-gonic/gin/gin.go:351 (0x8b4854) (*Engine).handleHTTPRequest: c.Next() /home/niklas/go/src/github.com/gin-gonic/gin/gin.go:318 (0x8b4092) (*Engine).ServeHTTP: engine.handleHTTPRequest(c) /usr/lib/go/src/net/http/server.go:2694 (0x67fc9b) serverHandler.ServeHTTP: handler.ServeHTTP(rw, req) /usr/lib/go/src/net/http/server.go:1830 (0x67be50) (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req) /usr/lib/go/src/runtime/asm_amd64.s:2361 (0x456e70) goexit: BYTE $0x90 // NOP </code></pre> </div>

ES 是否可以修改字段类型或者删除字段???

大佬们, ES有方法 可以修改字段类型或者删除字段吗?除了索引重建


ES地理位置映射,导入数据的时候如果对字段不存在,会报错400怎么解决? ![图片说明](https://img-ask.csdn.net/upload/201807/10/1531210759_194190.png) ES地理位置映射,Double数组的形式存储位置,映射发生错误 大家又遇到这种问题的吗? ![图片说明](https://img-ask.csdn.net/upload/201807/10/1531210773_727426.png)


<div class="post-text" itemprop="text"> <p>I try to update my database of elasticsearch with golang.I have two functions :</p> <pre><code>func UpdateAllByUserID(client *elastic.Client, id string, requestName string, requestNick string) error { ctx := context.Background() query := elastic.NewMatchQuery("user_id", id) out_name, err := client.UpdateByQuery().Index("test").Type("test").Query(query).Script(elastic.NewScriptInline("ctx._source.user_name = '" + requestName + "'")).Do(ctx) if nil != err { log.Println(err) } fmt.Println("update all name: ", out_name.Updated) return nil } func UpdateAllNicksByUserIdInFeed(client *elastic.Client, id string, requestNick string) error { ctx := context.Background() query := elastic.NewMatchQuery("user_id", id) out_nick, err := client.UpdateByQuery().Index("test").Type("test").Query(query).Script(elastic.NewScriptInline("ctx._source.user_nick = '" + requestNick + "'")).Do(ctx) if nil != err { log.Println(err) } fmt.Println("update all nick: ", out_nick.Updated) return nil } </code></pre> <p>The POST in elastic:</p> <pre><code>POST {index}/{type}/_update_by_query { "script": { "inline": "ctx._source.user_name = 'test'", "inline": "ctx._source.user_nick = 'test test'" }, "query": { "match": { "user_id": "mtJZngDOy6Qj22Qv9MEf1MhSLVb2" } } } </code></pre> <p>I'm using the library github.com/olivere/elastic. The versión of elasticsearch is 5.6 This functions per separate it works well, but I have two problems:</p> <p>How can update in the same function? Why then use the two functions at the same time I have this error:</p> <p>elastic: Error 409 (Conflict)</p> </div>


<div class="post-text" itemprop="text"> <p>In one of my index, I've got the 80000 documents. I'm trying to get all the data in a single hit. There is a maximum limit of 10000 data. </p> <p>How do I can get all 80000 records at a time through php ?.</p> <p>I'm referring this URL <a href="https://packagist.org/packages/elasticsearch/elasticsearch" rel="nofollow noreferrer">https://packagist.org/packages/elasticsearch/elasticsearch</a></p> <pre><code>$params = [ "scroll" =&gt; "30s", "size" =&gt; 10000, "index" =&gt; $stdIndex, 'type' =&gt; $stdIndexType]; $response = $client-&gt;search($params); while (isset($response['hits']['hits']) &amp;&amp; count($response['hits']['hits']) &gt; 0) { $scroll_id = $response['_scroll_id']; $response = $client-&gt;scroll([ "scroll_id" =&gt; $scroll_id, "scroll" =&gt; "30s"] ); } </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I have a project in golang which fetches logs from elastiearch where our servers send logs. I have a problem with multiple query. <strong>I want to query by two fields, where both must be found and filter result to get all these logs between two timestamps.</strong> In the code below attaching <code>deploymentName</code> object into <code>Filter()</code>causes for no results at all. </p> <pre class="lang-golang prettyprint-override"><code>import ("github.com/olivere/elastic") func main() { client, err := elastic.NewClient(elastic.SetURL(*elasticUrl)) //query by time timeQ := elastic.NewRangeQuery("@timestamp").From(from).To(to) //query by key named "component" componentQ := elastic.NewMatchQuery("component", *component) //query by key named "deploymentName", sam type as component deploymentQ := elastic.NewMatchQuery("deploymentName", deploymentName) //query object used for actual search later generalQ := elastic.NewBoolQuery().Should(). Filter(timeQ).Filter(componentQ).Filter(deploymentQ) searchResult, err := client.Search(). Index("some-index"). From(from).Size(*chunk). Query(generalQ). Sort("@timestamp", true). Do(context.Background()) } </code></pre> <p>While if generalQuery is written like this, it works.</p> <pre><code> //query object used for actual search later generalQ := elastic.NewBoolQuery().Should(). Filter(timeQ).Filter(componentQ) </code></pre> </div>

如何检查ElasticSearch BulkProcessor服务是否存在

<div class="post-text" itemprop="text"> <p>I am using <code>elastic</code> package for <code>golang</code>. I want to use its <code>BulkProcessor</code> for sending huge amount of documents in background. As per shown in <a href="https://github.com/olivere/elastic/wiki/BulkProcessor" rel="nofollow noreferrer">wiki</a>, I could create a processor. But I don't want to create it every time I send the documents. I want to know if there is processor service exists in the connection and pass data to existing processor rather than creating new. How can I achieve it?</p> </div>


<div class="post-text" itemprop="text"> <p>I have bellow data to index:</p> <pre><code>array:6 [▼ "index" =&gt; "my_index" "type" =&gt; "audit_field" "id" =&gt; "57f36d28a1dfc" "parent" =&gt; "57f36d289f1b2" "routing" =&gt; 318 "body" =&gt; array:19 [▼ "session_id" =&gt; 318 "trans_seq_no" =&gt; 13 "table_seq_no" =&gt; 13 "field_id" =&gt; 65 "field_name" =&gt; "id" "new_value" =&gt; 45 "old_value" =&gt; 45 "date_type_new_value" =&gt; null "date_type_old_value" =&gt; null "time_type_new_value" =&gt; null "time_type_old_value" =&gt; null ] ] </code></pre> <p>I have defined mapping myself as bellow</p> <pre><code>array( 'index' =&gt; 'promote_kmp', 'type' =&gt; 'audit_field', 'body' =&gt; [ 'audit_field' =&gt; [ '_source' =&gt; [ 'type' =&gt; 'string' ], "_parent" =&gt; [ "type" =&gt; "audit_table" ], 'properties' =&gt; [ 'session_id' =&gt; array('type' =&gt; 'string'), 'trans_seq_no' =&gt; array('type' =&gt; 'string'), 'table_seq_no' =&gt; array('type' =&gt; 'string'), 'field_id' =&gt; array('type' =&gt; 'string'), 'field_name' =&gt; array('type' =&gt; 'string'), 'old_value' =&gt; array( 'type' =&gt; 'string' ), 'new_value' =&gt; array( 'type' =&gt; 'string' ), 'date_type_new_value' =&gt; array( 'type' =&gt; 'date', 'format' =&gt;'YYYY-MM-dd HH:mm:ss||YYYY-MM-dd||MM/dd/yyyy||yyyy/MM/dd' ), 'date_type_old_value' =&gt; array( 'type' =&gt; 'date', 'format' =&gt;'YYYY-MM-dd HH:mm:ss||YYYY-MM-dd||MM/dd/yyyy||yyyy/MM/dd' ), 'time_type_new_value' =&gt; array( 'type' =&gt; 'date', 'format' =&gt; 'HH:mm:ss' ), 'time_type_old_value' =&gt; array( 'type' =&gt; 'date', 'format' =&gt; 'HH:mm:ss' ) ] ] ] ); </code></pre> <p>But when i wan to index data with null in date field, elasticsearch shows and exception that can't parse date field value with mapping date format types. How to solve this, i have also tried with empty, but not working, and give the same message.</p> <pre><code>MapperParsingException[failed to parse [date_type_new_value]]; nested: MapperParsingException[failed to parse date field [], tried both date format [YYYY-MM-dd HH:mm:ss||YYYY-MM-dd||MM/dd/yyyy||yyyy/MM/dd], and timestamp number with locale []]; nested: IllegalArgumentException[Invalid format: ""]; </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I've been reading the <a href="https://www.elastic.co/guide/index.html" rel="nofollow">documentation</a> and other example posts since yesterday to work out how to add <strong>sort by field</strong> and the <strong>direction</strong> to <a href="http://pastebin.com/wym1AKvE" rel="nofollow">my current query array here</a> but so far no luck. I've seen examples like <code>{"sort": {"_score": "desc"}, "query": { ....</code> but couldn't quiet get my head around it to modify my array since this is the very first time I'm dealing with ES.</p> <p>All I need is: I want to be able to sort by <code>price</code> or <code>stock</code> in <code>asc</code> or <code>desc</code> order.</p> <p>Everytime I try to update my array to implement sorting, I get <code>{"error":{"code":0,"message":"Invalid option sort"}}</code> error.</p> <p>NOTE: The query array is being passed to <a href="https://github.com/whiteoctober/Pagerfanta" rel="nofollow">Pagerfanta</a> to get results.</p> <pre><code> $paginator = $this-&gt;productFinder-&gt;findPaginated($myArray) -&gt;setMaxPerPage($limit) -&gt;setCurrentPage($page); </code></pre> </div>




<div class="post-text" itemprop="text"> <p>I'm using olivere's elastic v.5 Go library (<a href="https://godoc.org/gopkg.in/olivere/elastic.v5" rel="nofollow noreferrer">https://godoc.org/gopkg.in/olivere/elastic.v5</a>) for my Elastic queries. If I have an elastic mapping like this:</p> <pre><code>"mappings": { "boxes": { "properties": { "field1": { "type": "string" }, "field2": { "type": "string" }, "field3": { "type": "date" }, "field4": { "type": "date" } } } </code></pre> <p>And I want to get a list of all fields that have type 'date'.</p> <p>I've looked into <a href="https://godoc.org/gopkg.in/olivere/elastic.v5#Client.GetFieldMapping" rel="nofollow noreferrer">GetFieldMapping</a> but that doesn't seem to have an option to filter the fields based on type.</p> <p>I tried this:</p> <pre><code>elasticclient.GetFieldMapping().Index("someindex").Type("boxes").Field().Type("date").Pretty(true).Do(ctx) </code></pre> <p>That just gives me all the fields and their types. Is there a different syntax to do this? Thanks!</p> </div>

spring-data-elasticsearch 字段如何驼峰转下划线


es 查询怎么排除那些只要有一条数据是空的字段

es 查询怎么排除那些只要有一条数据是空的字段 比如我es中的数据是这样的: ``` { "took": 28, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 3, "max_score": 1, "hits": [ { "_index": "shop", "_type": "book", "_id": "AWlTdeg9-uKcfYQht2cG", "_score": 1, "_source": { "id": 10006573, "name": "Elasticsearch action", "author": "Radu Gheorghe", "num": 120, "content": "这本实战型的书籍聚焦在使用HTTP协议的Elasticsearch REST API代码片段的书写多数是使用cURL的bash脚本,所以很容易翻译成其他编程语言。", "price": 39.5, "published": "2018-10-01" } }, { "_index": "shop", "_type": "book", "_id": "AWlTkwr8-uKcfYQht2cH", "_score": 1, "_source": { "id": 20004812, "name": "Spring action", "author": "Radu go", "num": 120, "content": "这是一本简要简介spring d的书籍。", "price": 39.5 } }, { "_index": "shop", "_type": "book", "_id": "AWlTlIUH-uKcfYQht2cI", "_score": 1, "_source": { "id": 20004812, "name": "elasticsearch action", "author": "john" } } ] } } ``` 我要查询出来每条数据都不为空的字段,正确的结果应该是: { "id": 20004812, "name": "elasticsearch action", "author": "john" }


<div class="post-text" itemprop="text"> <p>I'm using olivere's v.5 elasticsearch library - <a href="https://godoc.org/github.com/olivere/elastic" rel="nofollow noreferrer">https://godoc.org/github.com/olivere/elastic</a></p> <p>Trying to do something similar to this post which uses the v.2 library - <a href="https://stackoverflow.com/questions/32674666/how-to-search-in-elasticsearch-with-go-filtering-results-by-time-frames">How to search in elasticsearch with Go filtering results by time frames</a></p> <p>But 'NewRangeFilter' and 'NewFilteredQuery' are not available in v.5. There is a 'DateRange' API in v.5 (<a href="https://godoc.org/github.com/olivere/elastic#Aggregations.DateRange" rel="nofollow noreferrer">https://godoc.org/github.com/olivere/elastic#Aggregations.DateRange</a>) that I can call from an Aggregation, but it takes in a string, so I don't know what I'm supposed to pass in. </p> <p>This is what I've tried so far to build an aggregation. After that, I'm not sure what to pass into the DateRange function. I have an index called 'tmpindex' and type called 'user' and each document has a 'timestamp' property which is an integer.</p> <pre><code>timeline := elasticClient.NewTermsAggregation().Field("timestamp").Size(10).OrderByCountDesc() searchResult, err := elasticClient.Search(). Index("tmpindex"). // search in index "tmpindex" Aggregation("timeline", timeline). From(0).Size(10). // take documents 0-9 Pretty(true). // pretty print request and response JSON Do(context.Background()) // execute if err != nil { return err } </code></pre> </div>

elasticsearch 父子查询和聚合

求大神,我用es的父子关系,查询数据,然后对查询出来的数据的任一字段进行聚合,怎么实现。我现在走到这一步了![图片说明](https://img-ask.csdn.net/upload/201703/22/1490178331_27849.jpg) 但是只能聚合父或者反过来聚合子的,没法聚合inner_hit里边的,看了5天的ES,就来任务了,亚历山大,求支援


<div class="post-text" itemprop="text"> <p>I am trying to Get data with specific fields from an Index. I am using olivere elastic client. I tried the following code to select Bedrooms,rooms and location fields from property Index.</p> <pre><code> query := elastic.NewBoolQuery() query = query.Must(elastic.NewTermQuery("rooms", "1")) query = query.Must(elastic.NewTermQuery("bedrooms", "1")) get1, err := client.Search("Bedrooms", "rooms", "location"). Index("property"). //Type("doc"). Query(query). Sort("id", true). Size(5000). Do(ctx) if err != nil { // Handle error panic(err) } </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I am new to ElasticSearch. I am working on a project where I have to search listings which matches the input <code>http://foo.bar/search?listing=123,456</code>. I have built an array which key and value are the same and representing the listing ids. I have tried to run the following example but it failed near contains. The script is built for painless language. However, I always get the runtime error. </p> <p>I cannot get this to work, what could I be doing wrong?</p> <pre><code> 'function_score' =&gt; [ 'query' =&gt; $query, 'score_mode' =&gt; 'sum', 'functions' =&gt; [[ 'script_score' =&gt; [ 'script' =&gt; [ 'params' =&gt; ['listing' =&gt; [123 =&gt; 123, 456 =&gt; 456]], 'source' =&gt; "(params.listing.contains(doc['id'].value) ? Math.pow(3, 3) : 0)", ], ], ]], ], </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I am using olivere/elastic to work with elasticsearch in Go. Here is my code:</p> <pre><code>// (1) delete document _, err := e.client.Delete().Index(index).Type("entity"). Id(id).Do(e.ctx) if err != nil { fmt.Println(err.Error()) } // (2) get all documents result, err := e.client.Search().Index(index).From(1).Size(100).Do(e.ctx) if err != nil { log.Println(err) } fmt.Println(result.TotalHits()) // (3) wait time.Sleep(3 * time.Second) // (4) get all documents result, err = e.client.Search().Index(index).From(1).Size(100).Do(e.ctx) if err != nil { log.Println(err) } fmt.Println(result.TotalHits()) </code></pre> <p>Here I am:</p> <ul> <li>delete document </li> <li>get all documents from collection</li> <li>wait 3 seconds</li> <li>get the same documents from collection</li> </ul> <p>Now on the step (2) I get one more document than step (4). Looks like the document is deleted in Elastic with some delay and I am searching the way to delete the document synchronously.</p> </div>



定量遥感中文版 梁顺林著 范闻捷译



YOLOv3是一种基于深度学习的端到端实时目标检测方法,以速度快见长。本课程将手把手地教大家使用labelImg标注和使用YOLOv3训练自己的数据集。课程分为三个小项目:足球目标检测(单目标检测)、梅西目标检测(单目标检测)、足球和梅西同时目标检测(两目标检测)。 本课程的YOLOv3使用Darknet,在Ubuntu系统上做项目演示。包括:安装Darknet、给自己的数据集打标签、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算和画出PR曲线)和先验框聚类。 Darknet是使用C语言实现的轻型开源深度学习框架,依赖少,可移植性好,值得深入探究。 除本课程《YOLOv3目标检测实战:训练自己的数据集》外,本人推出了有关YOLOv3目标检测的系列课程,请持续关注该系列的其它课程视频,包括: 《YOLOv3目标检测实战:交通标志识别》 《YOLOv3目标检测:原理与源码解析》 《YOLOv3目标检测:网络模型改进方法》 敬请关注并选择学习!

sql语句 异常 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your

在我们开发的工程中,有时候会报 [Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ------ 这种异常 不用多想,肯定是我们的sql语句出现问题,下面...

浪潮集团 往年的软件类 笔试题 比较详细的哦

浪潮集团 往年的软件类 笔试题 比较详细的哦

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!




董付国系列教材《Python程序设计基础》、《Python程序设计(第2版)》、《Python可以这样学》配套视频,讲解Python 3.5.x和3.6.x语法、内置对象用法、选择与循环以及函数设计与使用、lambda表达式用法、字符串与正则表达式应用、面向对象编程、文本文件与二进制文件操作、目录操作与系统运维、异常处理结构。


本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。



eclipseme 1.7.9

eclipse 出了新的eclipseme插件,官方有下载,但特慢,我都下了大半天(可能自己网速差)。有急需要的朋友可以下哦。。。

Spring Boot -01- 快速入门篇(图文教程)

Spring Boot -01- 快速入门篇 今天开始不断整理 Spring Boot 2.0 版本学习笔记,大家可以在博客看到我的笔记,然后大家想看视频课程也可以到【慕课网】手机 app,去找【Spring Boot 2.0 深度实践】的课程,令人开心的是,课程完全免费! 什么是 Spring Boot? Spring Boot 是由 Pivotal 团队提供的全新框架。Spring Boot...


本课程为HoloLens2开发入门教程,讲解部署开发环境,安装VS2019,Unity版本,Windows SDK,创建Unity项目,讲解如何使用MRTK,编辑器模拟手势交互,打包VS工程并编译部署应用到HoloLens上等。

最简单的倍频verilog程序(Quartus II)

一个工程文件 几段简单的代码 一个输入一个输出(50Mhz倍频到100Mhz)




这是一个门针对零基础学员学习微信小程序开发的视频教学课程。课程采用腾讯官方文档作为教程的唯一技术资料来源。杜绝网络上质量良莠不齐的资料给学员学习带来的障碍。 视频课程按照开发工具的下载、安装、使用、程序结构、视图层、逻辑层、微信小程序等几个部分组织课程,详细讲解整个小程序的开发过程

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?







课程亮点: 课程培训详细的笔记以及实例代码,让学员开始掌握设计模式知识点 课程内容: 工厂模式、桥接模式、组合模式、装饰器模式、外观模式、享元模式、原型模型、代理模式、单例模式、适配器模式 策略模式、模板方法模式、观察者模式、迭代器模式、责任链模式、命令模式、备忘录模式、状态模式、访问者模式 课程特色: 笔记设计模式,用笔记串连所有知识点,让学员从一点一滴积累,学习过程无压力 笔记标题采用关键字标识法,帮助学员更加容易记住知识点 笔记以超链接形式让知识点关联起来,形式知识体系 采用先概念后实例再应用方式,知识点深入浅出 提供授课内容笔记作为课后复习以及工作备查工具 部分图表(电脑PC端查看):




本课程内容系统、全面、简洁、通俗易懂,通过2个多小时的介绍,让大家对软件测试有个系统的理解和认识,具备基本的软件测试理论基础。 主要内容分为5个部分: 1 软件测试概述,了解测试是什么、测试的对象、原则、流程、方法、模型;&nbsp; 2.常用的黑盒测试用例设计方法及示例演示;&nbsp; 3 常用白盒测试用例设计方法及示例演示;&nbsp; 4.自动化测试优缺点、使用范围及示例‘;&nbsp; 5.测试经验谈。


本文的面试题如下: Redis 持久化机制 缓存雪崩、缓存穿透、缓存预热、缓存更新、缓存降级等问题 热点数据和冷数据是什么 Memcache与Redis的区别都有哪些? 单线程的redis为什么这么快 redis的数据类型,以及每种数据类型的使用场景,Redis 内部结构 redis的过期策略以及内存淘汰机制【~】 Redis 为什么是单线程的,优点 如何解决redis的并发竞争key问题 Red...


【超实用课程内容】 本课程演示的是一套基于Java的SSM框架实现的图书管理系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的java人群。详细介绍了图书管理系统的实现,包括:环境搭建、系统业务、技术实现、项目运行、功能演示、系统扩展等,以通俗易懂的方式,手把手的带你从零开始运行本套图书管理系统,该项目附带全部源码可作为毕设使用。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27513 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程2年有效观看时长,大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化






发现网上很多Java面试题都没有答案,所以花了很长时间搜集整理出来了这套Java面试题大全,希望对大家有帮助哈~ 本套Java面试题大全,全的不能再全,哈哈~ 一、Java 基础 1. JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境。 JRE:Java Runtime Environ...






CopyOnWriteArrayList.java和ArrayList.java,这2个类的构造函数,注释中有一句话 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public ArrayList(Collection&lt;? ...

相关热词 c# 解析cad c#数字格式化万 c#int转byte c#格式化日期 c# wpf 表格 c# 实现ad域验证登录 c#心跳包机制 c#使用fmod.dll c#dll vb 调用 c# outlook