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

add escaping for JSON response body filtering #11560

Closed
djschny opened this issue Jun 9, 2015 · 7 comments · Fixed by #14390
Closed

add escaping for JSON response body filtering #11560

djschny opened this issue Jun 9, 2015 · 7 comments · Fixed by #14390
Labels
:Core/Infra/REST API REST infrastructure and utilities >enhancement help wanted adoptme

Comments

@djschny
Copy link
Contributor

djschny commented Jun 9, 2015

Please add the ability to handle escaping for certain characters with the filter_path option. For example to allow the following to work for our common .marvel-* indices.

GET _stats?filter_path=indices.\.marvel*
@tlrx
Copy link
Member

tlrx commented Jun 11, 2015

I think we should add escaping to the filter_path option. Index names or field names can include dots or comma so we need to handle escaping to filter responses on those names.

@javanna javanna removed the v1.6.0 label Jun 11, 2015
@djschny
Copy link
Contributor Author

djschny commented Jun 11, 2015

Sorry about the v1.6.0 label. How do we indicate that a particular bug is only for a certain version?

@javanna
Copy link
Member

javanna commented Jun 11, 2015

hey @djschny no worries! we use versions to indicate when things get fixed, rather than which versions are affected. We actually have no way at the moment to specify which version is affected by a bug.

@clintongormley
Copy link

Here's a regex that will tokenize properly:

/(                 # capture either
    (?:            
        [^.,\\]    # any character except a comma, period, or backslash
      | \\.        # or a backslash followed by any character
    )+             # repeated as many times as possible
  | 
    [.,]           # or either a single comma or period
 )
/x

So this string: indices.\.marvel*.foo\,bar,indices.\.marvel*.\* would result in the following tokens:

  • indices
  • .
  • \.marvel*
  • .
  • foo\,bar
  • ,
  • indices
  • .
  • \.marvel*
  • .
  • \*

Then real asterisks should be separated from escaped asterisks, and then any other escapes should be removed.

@clintongormley
Copy link

Probably need to support + and - as well

@clintongormley
Copy link

Related to #11334

@clintongormley
Copy link

In order to handle escaped wildcards, we either need a state machine, or to reuse Lucene's automaton (which creates a lot of objects). Perhaps we just don't allow escaped wildcards, in which case we can use the simple pattern matching that we have today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/REST API REST infrastructure and utilities >enhancement help wanted adoptme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants