Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SearchBar] Added support for emitting a Query as an Elasticsearch query string #598

Merged
merged 1 commit into from
Mar 30, 2018
Merged

[SearchBar] Added support for emitting a Query as an Elasticsearch query string #598

merged 1 commit into from
Mar 30, 2018

Conversation

uboness
Copy link
Contributor

@uboness uboness commented Mar 30, 2018

Example:

const query = Query.parse(`john group:(eng or "marketing org") -date:'2004-03' -is:active`);
console.log(Query.toEsQueryString(query));

the above logs:

+john +(group:eng OR group:"marketing org") -date:(>=2004-03 AND <2004-04) +active:false

@uboness uboness changed the title [SearchBar] Added support for emitting a Query as an Elasticsearch qu… [SearchBar] Added support for emitting a Query as an Elasticsearch query string Mar 30, 2018
Copy link
Contributor

@chrisronline chrisronline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor question, but otherwise, LGTM!

I'm not sure if it will be necessary, but it's cool to see the possibility of AST -> KQL in the future!

}
};

const emitFieldDateValueCalue = (field, value, operator, match) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is Calue here? Typo for Clause?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep... typo :)

@uboness
Copy link
Contributor Author

uboness commented Mar 30, 2018

thx!

I'm not sure if it will be necessary, but it's cool to see the possibility of AST -> KQL in the future!

well... as far as I know, the saved objects api still requires you to provide an ES query string, doesn't it?

@chrisronline
Copy link
Contributor

Yea that's right, so this should be super helpful for that use case!

…ery string

Example:

```
const query = Query.parse(`john group:(eng or "marketing org") -date:'2004-03' -is:active`);
console.log(Query.toEsQueryString(query));
```

the above logs:

```
+john +(group:eng OR group:"marketing org") -date:(>=2004-03 AND <2004-04) +active:false
```
@uboness uboness merged commit a8df982 into elastic:master Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants