首页 \ 问答 \ 使用ElasticSearch Bulk动态更新和创建文档?(Using ElasticSearch Bulk to update and create documents dynamically?)

使用ElasticSearch Bulk动态更新和创建文档?(Using ElasticSearch Bulk to update and create documents dynamically?)

我目前正在使用elasticsearch并每10分钟运行一次cron作业,它将从我的数据库中找到新创建/更新的数据并将其与elasticsearch同步。 但是,我想使用bulk同步而不是在索引中进行更新/创建文档的任意数量的请求。 我正在使用elasticsearch创建的elasticsearch.js库。

我遇到了两个我不确定如何处理的挑战:

  • 如果文档存在,如何使用bulk更新文档,如果文档不在bulk内而不知道文档是否存在于索引中,则创建文档。
  • 如何格式化大量JSON以通过bulk运行来更新/创建文档,因为bulk api期望以某种方式格式化主体。

I'm currently using elasticsearch and running a cron job every 10 minutes that will find newly created/updated data from my DB and sync it with elasticsearch. However, I want to use bulk to sync instead of making and arbitrary amount of requests to update/create documents in an index. I'm using the elasticsearch.js library created by elasticsearch.

I face 2 challenges that I'm uncertain about how to handle:

  • How to use bulk to update a document if it exists and create a document if it doesn't within bulk without knowing if it exists in the index.
  • How to format a large amount of JSON to run through bulk to update/create the document because bulk api expects the body to be formatted a certain way.

原文:https://stackoverflow.com/questions/37665008
更新时间:2022-08-27 20:08

最满意答案

尝试删除bin和obj并重建项目。 在最后一次视觉工作室更新后,这个开始发生在我身上 另一个想法是杀死msbuilld程序。


Try to delete bin and obj and rebuild project. This start happend to me after last visual studio update. Another think is kill msbuilld proceses too.

相关问答

更多
  • 我不禁注意到你的活动名称是couk.doridori.goigoFull.Board但你缺少的自定义View类是couk.doridori.goigo.customUI.GoBoardView ...它看起来像你可能有两个不同的包(goigo vs vs goigoFull)。 你是否有机会用图书馆项目做出聪明的事情? 您将需要非常小心代码和布局xml中的完全限定的类名... (如果不是,请添加一些关于您的项目设置的更多信息,并粘贴layoutinflater令人窒息的布局XML) I can't help ...
  • 尝试删除bin和obj并重建项目。 在最后一次视觉工作室更新后,这个开始发生在我身上 另一个想法是杀死msbuilld程序。 Try to delete bin and obj and rebuild project. This start happend to me after last visual studio update. Another think is kill msbuilld proceses too.
  • 一个原因可能是您的类路径中有两个包具有相同的“TransactionSynchronization”类。 你能尝试以下吗? 你在WSO2_HOME / repository / components / dropins目录中有什么? 删除dropins中的所有jar并重新启动服务器并重新检查该问题。 如果错误仍然存在,请尝试从WSO2_HOME / repository / components / lib和WSO2_HOME / repository / components / dropins中删除sp ...
  • 如果有的话,这更像是一个智能警告。 这段代码应该仍然可以正常工作。 我认为这只是intellisense结尾的一个错误,它说它无法找到这些子元素中的一个,因为您正在创建一个扩展其中一个子元素的自定义视图。 正如您所看到的,这段代码运行得很好: This is more of an intellisense warning if anything. This code should still work just fine. I believe that this is merely an error on ...
  • 似乎你需要一个自定义弹出窗口,我已经为其他人编写了一个示例,它包含一个自定义UIView,你可以使用它并在其上添加你想要的任何内容。 示例自定义弹出窗口 希望它可以帮到你。 Seems you need a custom pop up, I have wrote a sample for others, it contains a custom UIView you can use it and add anything you want on it. Sample custom pop up Hope i ...
  • 解决方案 - 1 您可以在自定义控件中公开一些事件。 脚步: 在您的自定义HeaderBar控件中创建2个事件。 public event EventHandler RightButtonClickEvent; public event EventHandler LeftButtonClickEvent; 在XAML中分配Clicked事件处理程序,并在其中调用这些事件 void RightButton_Clicked(object sender, EventArgs e) { RightButt ...
  • 据我所知,你只需要设置InputAccessoryView。 只需要一个UIView(我会带一个UIToolbar),它应该在键盘出现时显示。 你必须自己设置UIView的框架。 示例: 如何在UIKeyboard上添加UIToolbar 要编辑文本,您可以使用NSAttributedString而不是String。 然后,您可以使用NSAttributedString而不是使用Text属性来设置AttributedText属性。 您还可以在NSAttributed String中为特定NSRanges设置 ...
  • 总之:它取决于您的要求(一个平台的小应用程序/原型或多个平台的更大应用程序)。 因此,您的问题有点基于意见。 你想只分配一次文本吗? 然后转到Designer或在代码中设置Text属性。 剩下的问题是,您使用每个支持的平台复制文本值。 你必须在iOS,Android,UWP,Windows Phone中设置它......如果你想改变它,那就太痛苦了。 我更喜欢与MvvMCross进行数据绑定。 我们几乎在每个项目中使用MvvMCross(从3年开始),因为它提供了严格的视图,数据和服务分离(使用IoC,Mv ...
  • 最后,我实施了一个基于选项A的解决方案。 我实现了一个继承自Android.Views.View的自定义视图。 该视图实现了GestureDetector.IOnGestureListener和ScaleGestureDetector.IOnScaleGestureListener接口,用于滚动和缩放。 在内部,我会跟踪当前内容位置,并仅绘制适合视图区域内的内容。 In the end I implemented a solution based on option A. I implemented a c ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。