Tag: elasticsearch

如何改变Elasticsearch 1.4中嵌套对象的types

目前,我的映射看起来像这样。 hal: { properties: { debug: { type: "string", fields: { raw: { type: "string", index: "not_analyzed" } } }, label: { type: "string", fields: { raw: { type: "string", index: "not_analyzed" } } }, score: { type: "double" }, sentiment: { type: "double" }, type: { type: "string", index: "not_analyzed" } } }, 但是从我的研究,我需要它是nestedtypes,否则我不能使用term和range的组合,因为元素是平坦的。 […]

对elasticsearch的GET请求中的'request_cache = true'不会创buildcaching

我有一个需要很长时间处理的查询。 因此,我想从elasticsearch获取caching的结果。 我发现的是,我必须: 传递size=0来获得caching的结果 或者在查询中传递request_cache=true 我的示例GET看起来像这样: curl 'localhost:9200/documentrevisions/_search?request_cache=true' -d '{"size": 10, "query": { }}' 我也发现了这个GitHub PR ,他们正在讨论这个问题。 但是,当我将size设置为大于0时,elasticsearch不会创buildcaching,即使在查询中传递request_cache=true时也是request_cache=true 。 这是一个错误? 或者我怎样才能确保我只是得到一定的结果,但仍然能够caching这些? 我正在使用NodeJS的弹性JS库。

illegal_argument_exception:没有为字段find映射

我正在尝试关注如何使用弹性search( version 12.1.0 )作为search引擎的一些教程。 而现在,我试图运行这几行: function initMapping() { return elasticClient.indices.putMapping({ index: indexName, type: "document", body: { properties: { title: { type: "string" }, content: { type: "string" }, suggest: { type: "completion", analyzer: "simple", search_analyzer: "simple", payloads: true } } } }); } function addDocument(document) { return elasticClient.index({ index: indexName, type: "document", body: { title: […]

elasticdump:dump以错误结束(get phase)=>错误:连接ECONNREFUSED MY_IP:PORT

当我使用本地主机作为IP地址,它按预期工作 C:\Users\Lenovo>elasticdump –input=http://localhost:9200/wellnessservices –out put=http://192.168.2.87:9200/wellnessservices –type=mapping Tue, 10 Jan 2017 09:56:47 GMT | starting dump Tue, 10 Jan 2017 09:56:47 GMT | got 1 objects from source elasticsearch (offset: 0) Tue, 10 Jan 2017 09:56:47 GMT | sent 1 objects to destination elasticsearch, wro te 1 Tue, 10 Jan 2017 09:56:47 GMT | got 0 […]

illegal_argument_exception请求包含无法识别的参数: – ElasticSearch索引创build

自从昨天以来,我第一次使用elasticsearch,并且由于我的知识有限,在两天的工作之后,我正在努力获得简单的function。 我的主要目标是用NodeJs + ElasticSearch完成一个糟糕的工作。 现在我坚持通过使用“映射”function创build索引。 我直接的问题是:为了使这个代码有效,我必须做些什么? return client.indices.create({ index: 'index_created_with_map', mapping: { posts: { user: { type: 'string' }, post_date: { type: 'string' }, message: { type: 'string' } } } }); 任何build议什么检查将不胜感激。 另外,虽然不是我主要问题的一部分,但是如何将get和search函数正确地返回给“response.send(JSON.stringify(来自elasticsearch的数据)”)以及如何将“post_date”映射到datetypesstring将不胜感激,因为我卡在它。 贝娄是我迄今为止所尝试过的。 我可以看到抛出“Chrome ElastiSearch工具箱扩展”,当我尝试没有“映射”function像addToIndex下面它的工作,但我想有单独的function,一个用于创build索引,我将只运行一次明显和另一个创build“logging”将成为我的一部分。 PS。 我在这里发现了非常类似的问题,没有任何答案 illegal_argument_exception:没有为字段find映射 错误日志: Unhandled rejection Error: [illegal_argument_exception] request [/index_created_with_map] contains unrecognized parameter: [mapping] at respond (/home/demetrio/dev/WSs/NodeJs/greencard-dmz-es-oracle/node_modules/elasticsearch/src/lib/transport.js:289:15) at […]

ElasticSearch – 聚合/分组:通过sorting和分页

我试图使用Elasticsearch(2.4)聚合通过使用该查询多个索引上的“productId”进行分组 { "from": 0, "size": 0, "min_score": 0.15, "query": { "filtered": { "query": { "bool": { "should": [ { "match_phrase_prefix": { "keywords.family": { "query": "low fat milk", "fuzziness": 0.7, "boost": 5 } } } ] } } } }, "aggs": { "group_by_0": { "terms": { "field": "productId", "size": 50 }, "aggs": { "top_tag_hits": { "top_hits": […]

弹性search关键字不匹配

我在弹性searchDB做search操作。我需要的是,如果我给search关键字“反应”,它应该只给结果匹配关键字“反应”,如果关键字是“反应路由器”,结果应该只包含“反应路由器”。 问题是,如果我给search关键字“反应”,结果匹配“反应路由器”关键字也检索。 有没有比match-phrase更好的select,我尝试了正则expression式和通配符,但没有用。 如何解决这个问题 `const searchTags = (tag) => { const answerPush = []; return new Promise((resolve, reject) => { client.search({ index : constants.QUESTIONNAIRE_INDEX, type : constants.QUESTIONS_TYPE, scroll : constants.SCROLL, body : { query : { match_phrase : { tags : tag } } } }, function getMoreUntilDone(err, res) { if (err) { reject(err); return; […]

MongoDB丰富文档的全文search

我正在开发一个将HTML文档存储在MongoDB数据库中的Node.js应用程序,并希望提供全文searchfunction。 从我可以看到,包含在MongoDB中的全文search期望文档是纯文本,因此不适合索引我的html文档。 这个假设是否正确?如果是这样的话,人们会推荐什么呢? 从阅读其他SOpost弹性search似乎是最有效的path。 我不能说我很高兴把Java应用程序带入图片。 还有一个完全独立的应用程序不是我的理想场景。

使用节点stream时内存不足

我正在尝试索引一个大(1 500 000行)文件并将其推送到弹性search。 为了做到这一点,我使用节点jsstream; 但是,我一直在耗尽内存。 我究竟做错了什么? var rl = null; initialize(function() { var stream = fs.createReadStream(process.argv[2]); rl = readline.createInterface({input: stream, terminal: false}); var i = 0; rl.on('line', function(line) { rl.pause(); processObject(++i, extractObject(line)); }); rl.on('close', function() { console.log('\nRefreshed index;'); process.exit(); }); }); function processObject(number, input) { client.index({ index: INDEX, type: TYPE, id: number, body: input }, […]

弹性search返回IndexMissingException

我试图在node.js中使用elasticSearch + mongose(这是elmongo)实现search引擎。 每当我尝试运行searchapi我得到“错误”:“IndexMissingException [[广告]失踪]” 这是代码 advertisingSchema.js var mongoose = require('mongoose'); var elmongo = require('elmongo'); var Schema = mongoose.Schema; var AdSchema = new Schema({ title: String, description: String, category: String, phoneNumber: { type: Number, unique: true}, photos: [{ type: String }], created: { type: Date, default: Date.now}, price: Number, password: String }); AdSchema.plugin(elmongo); module.exports = […]