<commit_before>UniQL-ES
=======

This generates ElasticSearch queries based on [UniQL](https://github.com/honeinc/uniql) ASTs.

support `query_string`, use `like` to replace

## Example

```javascript
var parse     = require( '../src/index' ).parse;
var esCompile = require( '../src/index').compile;

var ast = parse( '( height <= 20 or ( favorites.color == "green" and height != 25 and text like "google" ) ) and firstname ~= "o.+"' );
var esQuery = esCompile( ast );
console.log( util.inspect( esQuery, { depth: null } ) );
```

Resulting query:

```
{ query:
  { filtered:
    { filter:
      [ { bool:
        { must:
          [ { bool:
            { should:
              [ { range: { height: { lte: 20 } } },
                { bool:
                  { must:
                    [ { bool:
                      { must:
                        [ { term: { 'favorites.color': 'green' } },
                        { bool: { must_not: { term: { height: 25 } } } } ] } },
                    { fquery:
                      { _cache: true,
query: { bool: { should: [ { query_string: { fields: [ 'text' ], query: '"google"' } } ] } } } } ] } } ] } },
            { bool: { must: { regexp: { firstname: 'o.+' } } } } ] } } ] } } }

```

## License

[MIT](LICENSE)<commit_msg>* Fix<commit_after>UniQL-ES
=======

This generates ElasticSearch queries based on [UniQL](https://github.com/honeinc/uniql) ASTs.

支持`query_string`, 用`like` and `not_like` 标识

支持多个词查询，比如 color 在 [red, green], 使用 color == "red,green", 其实正常应该用`in`来标示

## Example

```javascript
var parse     = require( '../src/index' ).parse;
var esCompile = require( '../src/index').compile;

var ast = parse( '( height <= 20 or ( favorites.color == "green" and height != 25 and text like "google" ) ) and firstname ~= "o.+"' );
var esQuery = esCompile( ast );
console.log( util.inspect( esQuery, { depth: null } ) );
```

Resulting query:

```
{ query:
  { filtered:
    { filter:
      [ { bool:
        { must:
          [ { bool:
            { should:
              [ { range: { height: { lte: 20 } } },
                { bool:
                  { must:
                    [ { bool:
                      { must:
                        [ { terms: { 'favorites.color': ['green'] } },
                        { bool: { must_not: { term: { height: 25 } } } } ] } },
                    { fquery:
                      { _cache: true,
query: { bool: { should: [ { query_string: { fields: [ 'text' ], query: '"google"' } } ] } } } } ] } } ] } },
            { bool: { must: { regexp: { firstname: 'o.+' } } } } ] } } ] } } }

```

## License

[MIT](LICENSE)
{'fraction_non_alphanumeric': 0.18952999617883073, 'fraction_numerical': 0.00611387084447841, 'mean_word_length': 1.7851063829787235, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5462413', 'n_tokens_mistral': 901, 'n_tokens_neox': 852, 'n_words': 200}