Coder Social home page Coder Social logo

elastic-search-tests's Introduction

Elastic search use cases

This repo contains unit tests, describing ES real life use cases, using only the native JAVA API.

Installation prerequisites

To run these tests, you need:

  • JDK >=6
  • Git
  • Maven

Download the project

git clone https://github.com/jsebrien/elastic-search-tests.git

Compile the project

mvn package

Run tests

mvn test

Use cases

Geodistance search

751 cities are indexed, then perform a search to find cities far by 1000 km from Paris. Search results are showed in reversed order (the farthest displayed first).

The list of cities is stored in src/test/resources/cities.txt

Search parameters can be changed, using the following constants:

NB_MAX_RESULTS (default : 200)

ORIGIN_CITY_LON (default : 2.34 - Paris longitude)

ORIGIN_CITY_LAT (default : 48.86 - Paris lattitude)

DISTANCE_FROM_ORIGIN (default : 1000)

DISTANCE_UNIT (default : DistanceUnit.KILOMETERS)

Scan Search

728 ebooks are indexed, then perform a scan search for ebooks where the word "Biological" is part of their name. The list of ebooks is stored in src/test/resources/ebook2013.csv

Search parameters can be changed, using the following constants:

SCROLL_SIZE (default : 5) - retrieve 5 items per request

TEXT_TO_SEARCH (default : "Biological")

Some code snippets are taken from tests provided by David Pilato (aka dadoonet):

https://github.com/elasticsearchfr/elasticsearch-java-tests

elastic-search-tests's People

Contributors

jsebrien avatar

Watchers

James Cloos avatar Rasheed Amir avatar

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.