jest

Jest ElasticSearch Search API Hits mapping

这一生的挚爱 提交于 2019-12-25 18:13:19
问题 I'm extremely new to elastic search I'm trying to understanding the below code : List<Hit<Talk, Void>> hits = result.getHits(Talk.class); for (Hit<Talk, Void> hit: hits) { Talk talk = hit.source; log.info(talk.getTitle()); } This is directly taken from : https://www.elastic.co/blog/found-java-clients-for-elasticsearch My question is , how does Java know what field to map to what variable. Essentially , how does Java know , say to match the property "title" to the member variable "title" of

how to sort elasticsearch results using jest

雨燕双飞 提交于 2019-12-25 09:01:44
问题 so i'm using jest to practice elasticsearch 5.2 have this: @Override public List<Aptitude> findAllAptitudes() { SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); searchSourceBuilder.query(QueryBuilders.matchAllQuery()); Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(APTITUDE_INDEX_NAME).build(); try { SearchResult result = JestClientUtils.getClient().execute(search); List<Hit<Aptitude, Void>> aptitudes = result.getHits(Aptitude.class); return

jest tests are running beforeAll

喜欢而已 提交于 2019-12-24 22:52:04
问题 Scenario [UPDATED] I'm trying to connect to mongodb before running test cases and if I'm not wrong I can use beforeAll which is included in Jest where I can connect to my DB before running test cases, I am also testing my REST api with it Test const request = require ('supertest'); const app = require ('../../app'); const db = require ('../../db.js'); const url = 'mongodb://localhost:27017'; //UPDATED beforeALL (thanks to @andreas-köberle) beforeAll ((done) => { db.connect (url, (err) => { if

Reindex part of Elasticsearch index onto new index via Jest

淺唱寂寞╮ 提交于 2019-12-24 18:41:31
问题 I have a test ElasticSearch 6.0 index populated with millions of records, likely to be in the billions in production. I need to search for a subset of these records, then save this subset of the original set into a secondary index for later searching. I have proven this out via querying ES on Kibana, the challenge is to find appropriate APIs in Java 8 using my Jest client (searchbox.io, version 5.3.3) to do the same. The ElasticSearch cluster is on AWS, so using a transport client is out.

Filter context for should in bool query (Elasticsearch)

自闭症网瘾萝莉.ら 提交于 2019-12-24 18:22:25
问题 Elasticsearch documentation says "If the bool query is a filter context or has neither must or filter then at least one of the should queries must match a document for it to match the bool query." So I can have a bool query with a should clause along with must or filter within a filter context and then still get exact match. How to do this combination? I would also be interested in knowing how to do this with Jest client? 回答1: In that case you need to add minimum_should_match: 1 if you want

_msearch vs _search performance

爱⌒轻易说出口 提交于 2019-12-24 08:24:11
问题 _msearch is used for multiple searches in one go. This alone is a performance improvement since it reduces the network overhead. Right now I'm using _msearch like the _search endpoint, for single queries. I wanted to have this mechanism in place for future batch processing. Until I take advantage of the batch processing will this introduce an overhead? Does _msearch behave exactly the same as _search for single queries? 回答1: There's a very small overhead in the sense that even if you have one

Jest Cannot Create Objects from Imported Classes

懵懂的女人 提交于 2019-12-24 06:24:51
问题 In ChangesFactory-test.js I am importing the class I want to test like so: import ChangesFactory from 'path/to/src/ChangesFactory' I am trying to create an instance in a test case like this: describe('Changes', function () { it ('testConstructor', function() { // test that a username can be passed in let changesFactory = new ChangesFactory(USERNAME); However, running the above code leaves the value of changesFactory undefined. The constructor of the ChangesFactory class is written as: export

Elastic Search - java api for inner hit

那年仲夏 提交于 2019-12-24 04:58:43
问题 I made some query like below. "query" : { "nested" : { "path" : "comments.votes", "query" : { ... }, "inner_hits" : {} } } and I convert it as java api QueryBuilders.boolQuery().must( boolQuery ) .must( // error here if i changed as '.innerHit()' QueryBuilders.nestedQuery("comments.votes", QueryBuilders.boolQuery().must( ... ) ) .innerHit( new QueryInnerHitBuilder()) // error here ) It's how I made java code on ES version 2.x. Since I changed ES version 5.x, It's not functional at all. How

Elasticsearch Delete by query using jest [closed]

前提是你 提交于 2019-12-23 22:19:45
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I find an interesting feature called delete by query. How do I use it with jest client? Thanks! 回答1: You can use the DeleteByQuery class like shown below: DeleteByQuery deleteAllUserJohn = new DeleteByQuery.Builder("{\"user\":\"john\"}") .addIndex("users") .addType("user") .build(); client.execute

SyntaxError: Unexpected token import with Jest + react-native-animated-ellipsis

谁都会走 提交于 2019-12-23 19:51:45
问题 My snapshot test is failing with react-native. I have followed few solutions but nothing worked. Error I am facing is: /Users/USER_NAME/Projects/project_name/node_modules/react-native-animated-ellipsis/dist/AnimatedEllipsis.js:1 (function (exports, require, module, __filename, __dirname) { import React, { Component } from 'react'; ^^^^^^ SyntaxError: Unexpected token import at node_modules/babel-core/lib/transformation/file/options/option-manager.js:178:20 In my package.json : "jest": {