Skip to content

Commit

Permalink
Implemented feature for elastic java client to enable query string qu…
Browse files Browse the repository at this point in the history
…ery parsing for raw query instructions
  • Loading branch information
JohannesDaniel committed Jun 1, 2023
1 parent bc3ede5 commit ea79126
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,32 @@ final QueryRewriting<Query> queryRewriting = QueryRewriting.<Query>builder()

Using this converter requires including the dependency for the client as Querqy-Unplugged only includes it as `compileOnly`.

The definition of RawQuery instructions always have been cumbersome for Elasticsearch as it expects JSON as a default for queries.
Therefore, users were required to define RawQuery instructions as follows:

```text
apple =>
FILTER: * {\"term\":{\"type\":\"smartphone\"}}
```

Querqy-Unplugged facilitates this by enabling users to define RawQuery instructions using the
[Query String Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html)
syntax. So the rule above can be defined as follows:

```text
apple =>
FILTER: * type:smartphone
```

If you require Querqy-Unplugged to expect RawQuery instructions as JSON, you need to pass a `ESJavaClientConverterConfig`
to the `ESJavaClientConverterFactory`:

```java
final ConverterFactory<Query> converterFactoryJson = ESJavaClientConverterFactory.of(
ESJavaClientConverterConfig.builder()
.rawQueryInputType(ESJavaClientConverterConfig.RawQueryInputType.JSON)
.build());
```

#### Implementing additional converters

Expand Down

0 comments on commit ea79126

Please sign in to comment.