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

searching across multiple types returns doesn't find all documents matching #4418

Closed
billumina opened this issue Dec 11, 2013 · 1 comment
Closed

Comments

@billumina
Copy link

I include a bash script that recreates the situation.

#!/bin/sh

curl -XDELETE "http://localhost:9200/test"
curl -XPUT "http://localhost:9200/test"

echo

curl -XPUT "http://localhost:9200/test/foo/_mapping" -d '{
    "foo" : { 
        "properties" : {
            "id": {
                "type" : "multi_field",
                "path": "full",
                "fields" : {
                    "foo_id_in_another_field" : {"type" : "long", include_in_all:false },
                "id" : {"type" : "long"}
                   }
        }
    }
    }
}'

echo

#foo is a basically a duplicate of the foo document to support search use cases
curl -XPUT "http://localhost:9200/test/bar/_mapping" -d '{
    "bar" : {
        "properties" : {
            "id": {
                "type" : "multi_field",
                "path": "full",
                "fields" : {
                    "bar_id_in_another_field" : {"type" : "long", include_in_all:false },
                    "id" : {"type" : "long"}
                   }
                },
        "foo": {
            "properties": {
                "id": {
                    "type" : "multi_field",
                    "path": "full",
                    "fields" : {
                        "foo_id_in_another_field" : {"type" : "long", include_in_all:false },
                        "id" : {"type" : "long"}
                    }
                }
            }
        }
        }
    }
}'

echo

curl -XPUT "http://localhost:9200/test/foo/1?refresh=true" -d '{
    "foo": {
                "id": 1
    }
}'

echo

#failure case appears even when not including the following JSON
# "bar": {
#   "id": 2,
#   "foo": {
#     "id": 3
#   }
# }
curl -XPUT "http://localhost:9200/test/bar/2?refresh=true" -d '{
    "bar": {
        "id": 2
    }
}'

echo

#expect two results, get one (FAIL)
curl -XPOST "http://localhost:9200/test/foo,bar/_search?pretty=true" -d '{
  "size": 10,
  "query": {
    "query_string": {
      "query": "foo.id:1 OR bar.id:2"
    }
  }
}'

echo

#except one result, get one (PASS)
curl -XPOST "http://localhost:9200/test/bar/_search?pretty=true" -d '{
  "size": 10,
  "query": {
    "query_string": {
      "query": "foo.id:1 OR bar.id:2"
    }
  }
}'

echo

#expect one result, get one result (PASS)
curl -XPOST "http://localhost:9200/test/foo/_search?pretty=true" -d '{
  "size": 10,
  "query": {
    "query_string": {
      "query": "foo.id:1 OR bar.id:2"
    }
  }
}'

echo

#expect two results, get tow results (PASS)
curl -XPOST "http://localhost:9200/test/_search?pretty=true" -d '{
  "size": 10,
  "query": {
    "query_string": {
      "query": "foo.id:1 OR bar.id:2"
    }
  }
}'
@billumina
Copy link
Author

Same as #4081

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

No branches or pull requests

1 participant