Searching on more types but results only for one type, please help!


(zhairong) #1

dear all,
I have the following case:
index: pms
type: Unit, Building

searching with one type:
curl -XGET 'http://localhost:9200/pms/Building/_search?pretty=true' -d '{
"query" : {
"wildcard": { "street1" : "test_street1_11*" }
}
}
'
I get the response:
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "pms",
"_type" : "Building",
"_id" : "11",
"_score" : 1.0, "source" : {"id":11,"address":{"street2":"test_street2_11","region":"test_region_11","id":11,"street1":"test_street1_11","postalCode":"40349","country":{"id":1,"isoName":"test"},"city":"test_city_11"},"buildingType":"TYPE3","units":3}
} ]
}
}

searching with unit:

curl -XGET 'http://localhost:9200/pms/Unit/_search?pretty=true' -d '{
"query" : {
"wildcard": { "street1" : "test_street1_11*" }
}
}
I get response:
{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "pms",
"_type" : "Unit",
"_id" : "53",
"_score" : 1.0, "source" : {"id":53,"building":{"id":1128,"address":{"street2":"test_street2_1128","region":"test_region_1128","id":1128,"street1":"test_street1_1128","postalCode":"51035","country":{"id":2,"isoName":"test"},"city":"test_city_1128"},"buildingType":"OLD","units":7},"numberRooms":7,"unitType":"TYPE3","unitNumber":"62","floorNumber":7,"ownershipShare":4}
} ]
}
}

so I think, if I search with 2 types unit and building, I should get 2 result:

curl -XGET 'http://localhost:9200/pms/Unit,Building/_search?pretty=true' -d '{
"query" : {
"wildcard": { "street1" : "test_street1_11*" }
}
}

But I get only one, if types is Unit,Building, I get result only for Unit, if type are Building,Unit, I get result only for Building.

But I want result for buiding and unit.

please help, thanks!


(system) #2