Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/santik/sqlelasticsearchqueryconverter

Converts AND OR SQL like query to Elastic Search query
https://github.com/santik/sqlelasticsearchqueryconverter

andor elasticsearch php query query-builder query-parser querystring sql

Last synced: 3 months ago
JSON representation

Converts AND OR SQL like query to Elastic Search query

Awesome Lists containing this project

README

        

# SqlElasticSearchQueryConverter
Converts AND OR SQL like query to Elastic Search query

`
((("query1 query 2" OR query3) OR query4) AND (query5 OR query6)) AND query7
`

TO

`
{"bool":{"must":[{"bool":{"must":[{"bool":{"should":[{"bool":{"should":[{"match_phrase":{"field":"query1 query 2"}},{"match":{"field":"query3"}}]}},{"match":{"field":"query4"}}]}},{"bool":{"should":[{"match":{"field":"query5"}},{"match":{"field":"query6"}}]}}]}},{"match":{"field":"query7"}}]}}
`

# Installation

```console
$ composer require santik/sql-elasticsearch-query-converter
```
# Usage

Look at examples/example1.php