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

Percolator: Fix handling of nested documents #6540

Closed
bly2k opened this issue Jun 17, 2014 · 0 comments
Closed

Percolator: Fix handling of nested documents #6540

bly2k opened this issue Jun 17, 2014 · 0 comments

Comments

@bly2k
Copy link
Contributor

bly2k commented Jun 17, 2014

The percolator appears to have some strange matching behavior with nested objects defined in the document mapping. Steps to reproduce:

curl -XDELETE localhost:9200/test

curl -XPUT localhost:9200/test -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"doc": {
"properties": {
"persons": {
"type": "nested"
}
}
}
}
}'

curl -XPUT localhost:9200/test/.percolator/1 -d '{
"query": {
"bool": {
"must": {
"match": {
"name": "obama"
}
}
}
}
}'

curl -XPUT localhost:9200/test/.percolator/2 -d '{
"query": {
"bool": {
"must_not": {
"match": {
"name": "obama"
}
}
}
}
}'

curl -XPUT localhost:9200/test/.percolator/3 -d '{
"query": {
"bool": {
"must": {
"match": {
"persons.foo": "bar"
}
}
}
}
}'

curl -XPUT localhost:9200/test/.percolator/4 -d '{
"query": {
"bool": {
"must_not": {
"match": {
"persons.foo": "bar"
}
}
}
}
}'

curl -XPUT localhost:9200/test/.percolator/5 -d '{
"query": {
"bool": {
"must": {
"nested": {
"path": "persons",
"query": {
"match": {
"persons.foo": "bar"
}
}
}
}
}
}
}'

curl -XPUT localhost:9200/test/.percolator/6 -d '{
"query": {
"bool": {
"must_not": {
"nested": {
"path": "persons",
"query": {
"match": {
"persons.foo": "bar"
}
}
}
}
}
}
}'

curl -XPOST localhost:9200/_refresh

Thi should only match 1 and 5, but instead it matches 1,2,3,4,5,6

curl -XPOST localhost:9200/test/doc/_percolate?pretty -d '{
"doc": {
"name": "obama",
"persons": [
{
"foo": "bar"
}
]
}
}'

@bly2k bly2k added bug labels Jun 17, 2014
brwe added a commit to brwe/elasticsearch that referenced this issue Jun 18, 2014
Nested documents were indexed as separate documents, but it was never checked
if the hits represent nested documents or not. Therefore, nested objects could
match not nested queries and nested queries could also match not nested documents.

Examples are in issue elastic#6540 .

closes elastic#6540
@brwe brwe added v1.2.2 and removed v1.2.1 labels Jun 18, 2014
@brwe brwe closed this as completed in fe89ea1 Jun 18, 2014
brwe added a commit that referenced this issue Jun 18, 2014
Nested documents were indexed as separate documents, but it was never checked
if the hits represent nested documents or not. Therefore, nested objects could
match not nested queries and nested queries could also match not nested documents.

Examples are in issue #6540 .

closes #6540
closes #6544
brwe added a commit that referenced this issue Jun 18, 2014
Nested documents were indexed as separate documents, but it was never checked
if the hits represent nested documents or not. Therefore, nested objects could
match not nested queries and nested queries could also match not nested documents.

Examples are in issue #6540 .

closes #6540
closes #6544
brwe added a commit that referenced this issue Jun 18, 2014
Nested documents were indexed as separate documents, but it was never checked
if the hits represent nested documents or not. Therefore, nested objects could
match not nested queries and nested queries could also match not nested documents.

Examples are in issue #6540 .

closes #6540
closes #6544
@spinscale spinscale changed the title Percolator nested documents error Percolator: Fix handling of nested documents Jun 18, 2014
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
Nested documents were indexed as separate documents, but it was never checked
if the hits represent nested documents or not. Therefore, nested objects could
match not nested queries and nested queries could also match not nested documents.

Examples are in issue elastic#6540 .

closes elastic#6540
closes elastic#6544
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants