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!
Rong


(David Pilato) #2

What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a écrit :

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


(zhairong) #3

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:

What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a
écrit :

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


(David Pilato) #4

That's strange.
Can you gist a full curl recreation ?

BTW, which ES version are you using?

--

Le 28 juil. 2012 à 11:16, Rong Zhai zhairong1975@googlemail.com a écrit :

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:
What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a écrit :

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


(zhairong) #5

what is a full curl recreation? I use es 0.19.4.
regards,
Rong

2012/7/28 David Pilato david@pilato.fr

That's strange.
Can you gist a full curl recreation ?

BTW, which ES version are you using?

--

Le 28 juil. 2012 à 11:16, Rong Zhai zhairong1975@googlemail.com a
écrit :

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:

What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a
écrit :

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


(David Pilato) #6

See http://www.elasticsearch.org/help/

--

Le 28 juil. 2012 à 11:23, Rong Zhai zhairong1975@googlemail.com a écrit :

what is a full curl recreation? I use es 0.19.4.
regards,
Rong

2012/7/28 David Pilato david@pilato.fr
That's strange.
Can you gist a full curl recreation ?

BTW, which ES version are you using?

--

Le 28 juil. 2012 à 11:16, Rong Zhai zhairong1975@googlemail.com a écrit :

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:
What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a écrit :

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


(zhairong) #7

Thanks, I get this:

curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
{
"cluster_name" : "estatefusion",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 5,
"active_shards" : 5,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 5
}

Rong

2012/7/28 David Pilato david@pilato.fr

See http://www.elasticsearch.org/help/

--

Le 28 juil. 2012 à 11:23, Rong Zhai zhairong1975@googlemail.com a
écrit :

what is a full curl recreation? I use es 0.19.4.
regards,
Rong

2012/7/28 David Pilato david@pilato.fr

That's strange.
Can you gist a full curl recreation ?

BTW, which ES version are you using?

--

Le 28 juil. 2012 à 11:16, Rong Zhai zhairong1975@googlemail.com a
écrit :

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:

What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a
écrit :

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


(David Pilato) #8

You misunderstood.
Create a gist : gist.github.com
Create a Shell script with curl commands:
Delete index
Create index
Create doc1
Create doc2
Refresh type1,type2
Search

This way, I can download the test case and run it on my side.

David

--

Le 28 juil. 2012 à 11:37, Rong Zhai zhairong1975@googlemail.com a écrit :

Thanks, I get this:

curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
{
"cluster_name" : "estatefusion",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 5,
"active_shards" : 5,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 5
}

Rong

2012/7/28 David Pilato david@pilato.fr
See http://www.elasticsearch.org/help/

--

Le 28 juil. 2012 à 11:23, Rong Zhai zhairong1975@googlemail.com a écrit :

what is a full curl recreation? I use es 0.19.4.
regards,
Rong

2012/7/28 David Pilato david@pilato.fr
That's strange.
Can you gist a full curl recreation ?

BTW, which ES version are you using?

--

Le 28 juil. 2012 à 11:16, Rong Zhai zhairong1975@googlemail.com a écrit :

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:
What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a écrit :

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


(zhairong) #9

i am doing this, just 2 minutes.
rong

2012/7/28 David Pilato david@pilato.fr

You misunderstood.
Create a gist : gist.github.com
Create a Shell script with curl commands:
Delete index
Create index
Create doc1
Create doc2
Refresh type1,type2
Search

This way, I can download the test case and run it on my side.

David

--

Le 28 juil. 2012 à 11:37, Rong Zhai zhairong1975@googlemail.com a
écrit :

Thanks, I get this:

curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
{
"cluster_name" : "estatefusion",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 5,
"active_shards" : 5,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 5
}

Rong

2012/7/28 David Pilato david@pilato.fr

See http://www.elasticsearch.org/help/

--

Le 28 juil. 2012 à 11:23, Rong Zhai zhairong1975@googlemail.com a
écrit :

what is a full curl recreation? I use es 0.19.4.
regards,
Rong

2012/7/28 David Pilato david@pilato.fr

That's strange.
Can you gist a full curl recreation ?

BTW, which ES version are you using?

--

Le 28 juil. 2012 à 11:16, Rong Zhai zhairong1975@googlemail.com a
écrit :

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:

What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a
écrit :

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


(zhairong) #10


you can create the index and search with one type or more types.

regards,
Rong

2012/7/28 Rong Zhai zhairong1975@googlemail.com

i am doing this, just 2 minutes.
rong

2012/7/28 David Pilato david@pilato.fr

You misunderstood.
Create a gist : gist.github.com
Create a Shell script with curl commands:
Delete index
Create index
Create doc1
Create doc2
Refresh type1,type2
Search

This way, I can download the test case and run it on my side.

David

--

Le 28 juil. 2012 à 11:37, Rong Zhai zhairong1975@googlemail.com a
écrit :

Thanks, I get this:

curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
{
"cluster_name" : "estatefusion",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 5,
"active_shards" : 5,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 5
}

Rong

2012/7/28 David Pilato david@pilato.fr

See http://www.elasticsearch.org/help/

--

Le 28 juil. 2012 à 11:23, Rong Zhai zhairong1975@googlemail.com a
écrit :

what is a full curl recreation? I use es 0.19.4.
regards,
Rong

2012/7/28 David Pilato david@pilato.fr

That's strange.
Can you gist a full curl recreation ?

BTW, which ES version are you using?

--

Le 28 juil. 2012 à 11:16, Rong Zhai zhairong1975@googlemail.com a
écrit :

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:

What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a
écrit :

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


(David Pilato) #11

I see.

I updated the gist here : https://gist.github.com/3192819

Problem was that in Building type, street1 is under address
(address.street1)

In Unit type, street1 is under building.address. (building.address.street1)

In the gist I sent, I just added a building level on Building type and it
works.

I cannot say if it’s an issue or not.

I suppose that Elasticsearch find a first document that match on
building.address.street1 level and try to find if other documents match on
this field but with no success.

HTH

David.

De : elasticsearch@googlegroups.com [mailto:elasticsearch@googlegroups.com]
De la part de Rong Zhai
Envoyé : samedi 28 juillet 2012 12:05
À : elasticsearch@googlegroups.com
Objet : Re: searching on more types but results only for one type, please
help!


you can create the index and search with one type or more types.

regards,
Rong

2012/7/28 Rong Zhai zhairong1975@googlemail.com

i am doing this, just 2 minutes.
rong

2012/7/28 David Pilato david@pilato.fr

You misunderstood.

Create a gist : gist.github.com

Create a Shell script with curl commands:

Delete index

Create index

Create doc1

Create doc2

Refresh type1,type2

Search

This way, I can download the test case and run it on my side.

David

--

Le 28 juil. 2012 à 11:37, Rong Zhai zhairong1975@googlemail.com a écrit :

Thanks, I get this:

curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
{
"cluster_name" : "estatefusion",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 5,
"active_shards" : 5,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 5
}

Rong

2012/7/28 David Pilato david@pilato.fr

See http://www.elasticsearch.org/help/

--

Le 28 juil. 2012 à 11:23, Rong Zhai zhairong1975@googlemail.com a écrit :

what is a full curl recreation? I use es 0.19.4.
regards,
Rong

2012/7/28 David Pilato david@pilato.fr

That's strange.

Can you gist a full curl recreation ?

BTW, which ES version are you using?

--

Le 28 juil. 2012 à 11:16, Rong Zhai zhairong1975@googlemail.com a écrit :

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:

What happens if you do:

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

--

Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a écrit :

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


(zhairong) #12

I think it's a issue, the nested objects have its own architecture,
actuelly I can not add building to type building, because it's already
under Building. We have 3 Tables Unit, Building, and Address, Unit contents
Building, Building contains Address, we want search with address and get
two lists: building and unit.

but anyway, thank you for your support, if the problem can be fixed, please
notice me, thank you.

regards,
Rong

2012/7/28 David Pilato david@pilato.fr

I see.****


I updated the gist here : https://gist.github.com/3192819****


Problem was that in Building type, street1 is under address
(address.street1)****

In Unit type, street1 is under building.address. (building.address.street1)



In the gist I sent, I just added a building level on Building type and it
works.****



I cannot say if it’s an issue or not.****

I suppose that Elasticsearch find a first document that match on
building.address.street1 level and try to find if other documents match on
this field but with no success.****



HTH****

David.****



De : elasticsearch@googlegroups.com [mailto:
elasticsearch@googlegroups.com] De la part de Rong Zhai
Envoyé : samedi 28 juillet 2012 12:05
À : elasticsearch@googlegroups.com
Objet : Re: searching on more types but results only for one type,
please help!****


https://gist.github.com/3192732
you can create the index and search with one type or more types.

regards,
Rong****

2012/7/28 Rong Zhai zhairong1975@googlemail.com****

i am doing this, just 2 minutes.
rong****


2012/7/28 David Pilato david@pilato.fr****

You misunderstood.****

Create a gist : gist.github.com ****

Create a Shell script with curl commands:****

Delete index****

Create index****

Create doc1****

Create doc2****

Refresh type1,type2****

Search ****


This way, I can download the test case and run it on my side.****


David****

--****


Le 28 juil. 2012 à 11:37, Rong Zhai zhairong1975@googlemail.com a
écrit :****

Thanks, I get this:

curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
{
"cluster_name" : "estatefusion",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 5,
"active_shards" : 5,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 5
}

Rong


2012/7/28 David Pilato david@pilato.fr****

See http://www.elasticsearch.org/help/****

--****


Le 28 juil. 2012 à 11:23, Rong Zhai zhairong1975@googlemail.com a
écrit :****

what is a full curl recreation? I use es 0.19.4.
regards,
Rong****

2012/7/28 David Pilato david@pilato.fr****

That's strange.****

Can you gist a full curl recreation ?****


BTW, which ES version are you using?****

--****


Le 28 juil. 2012 à 11:16, Rong Zhai zhairong1975@googlemail.com a
écrit :****

I get still only result for one type: Building
regards,
Rong

On Saturday, July 28, 2012 11:12:02 AM UTC+2, David Pilato wrote:****

What happens if you do:****


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


--****


Le 28 juil. 2012 à 11:03, Rong Zhai zhairong1975@googlemail.com a
écrit :****

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






(system) #13