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

Source filtering with wildcards broken when given multiple patterns #5132

Closed
lfrancke opened this issue Feb 14, 2014 · 2 comments
Closed

Source filtering with wildcards broken when given multiple patterns #5132

lfrancke opened this issue Feb 14, 2014 · 2 comments
Assignees

Comments

@lfrancke
Copy link
Contributor

curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
    "user" : "kimchy",
    "post_date" : "2009-11-15T14:12:12",
    "message" : "trying out Elasticsearch", "retweeted": false
}'

No source fields delivered:

curl -XGET 'http://localhost:9200/twitter/tweet/1?_source=*.id,retweeted&pretty=yes'

retweeted returned:

curl -XGET 'http://localhost:9200/twitter/tweet/1?_source=retweeted,*.id&pretty=yes'

This happens because the filter breaks out of the loop instead of continuing to check whether any of the other includes may match. Replacing the break with a continue fixes this. But I hesitate to submit a pull request because I didn't have time to fully understand this code.

I understand that this is a corner case but it's a new feature in 1.0 and the example in the documentation does not work due to this bug.

@dadoonet dadoonet self-assigned this Feb 15, 2014
@dadoonet
Copy link
Member

Agreed. I can reproduce it and fix it.
Currently running tests and will send a PR if there is no side effect.

BTW, you can send PR if you think it fixes thing and we will be happy to comment on PR if there is anything wrong or if it needs some modification. :-)

Thanks!

dadoonet added a commit to dadoonet/elasticsearch that referenced this issue Feb 15, 2014
```
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
    "user" : "kimchy",
    "post_date" : "2009-11-15T14:12:12",
    "message" : "trying out Elasticsearch", "retweeted": false
}'
```

No source fields delivered:

```
curl -XGET 'http://localhost:9200/twitter/tweet/1?_source=*.id,retweeted&pretty=yes'
```

`retweeted` returned:

```
curl -XGET 'http://localhost:9200/twitter/tweet/1?_source=retweeted,*.id&pretty=yes'
```

Closes elastic#5132.
@dadoonet
Copy link
Member

Tests pass with the modification. PR #5133 created with a fix and a test.

dadoonet added a commit that referenced this issue Feb 17, 2014
```
curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '{
    "user" : "kimchy",
    "post_date" : "2009-11-15T14:12:12",
    "message" : "trying out Elasticsearch", "retweeted": false
}'
```

No source fields delivered:

```
curl -XGET 'http://localhost:9200/twitter/tweet/1?_source=*.id,retweeted&pretty=yes'
```

`retweeted` returned:

```
curl -XGET 'http://localhost:9200/twitter/tweet/1?_source=retweeted,*.id&pretty=yes'
```

Closes #5132.
Closes #5133.
(cherry picked from commit 5d15936)
fixmebot bot referenced this issue in VectorXz/elasticsearch Apr 22, 2021
fixmebot bot referenced this issue in VectorXz/elasticsearch May 28, 2021
fixmebot bot referenced this issue in VectorXz/elasticsearch Aug 4, 2021
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 a pull request may close this issue.

2 participants