Search question


(elasticuser-2) #1

Hello,

In this example :

$ curl -XPUT 'http://localhost:9200/test/dir/1' -d '{
"name" : "dir1",
"hash" : "11a3e229084349bc25d97e29393ced1d"
}'
$ curl -XPUT 'http://localhost:9200/test/dir/2' -d '{
"name" : "dir2",
"hash" : "61a1d3d61d5c3f134006f9302b1e4775"
}'
$ curl -XPUT 'http://localhost:9200/test/dir/3' -d '{
"name" : "test1",
"hash" : "3e7705498e8be60520841409ebc69bc1"
}'

$ curl -XPUT 'http://localhost:9200/test/file/1' -d '{
"name" : "file1",
"hash" : "11a3e229084349bc25d97e29393ced1d"
}'
$ curl -XPUT 'http://localhost:9200/test/file/2' -d '{
"name" : "filte2",
"hash" : "62108f16c7d809f960d745b446d91a08"
}'

How I can search into dir type all dir where "name=dir*" and hash is into
file type ?

Thanks.


(elasticuser-2) #2

Hello,

Someone has an idea ?

Thanks.

On Wednesday, August 1, 2012 12:58:29 PM UTC+2, elasticuser wrote:

Hello,

In this example :

$ curl -XPUT 'http://localhost:9200/test/dir/1' -d '{
"name" : "dir1",
"hash" : "11a3e229084349bc25d97e29393ced1d"
}'
$ curl -XPUT 'http://localhost:9200/test/dir/2' -d '{
"name" : "dir2",
"hash" : "61a1d3d61d5c3f134006f9302b1e4775"
}'
$ curl -XPUT 'http://localhost:9200/test/dir/3' -d '{
"name" : "test1",
"hash" : "3e7705498e8be60520841409ebc69bc1"
}'

$ curl -XPUT 'http://localhost:9200/test/file/1' -d '{
"name" : "file1",
"hash" : "11a3e229084349bc25d97e29393ced1d"
}'
$ curl -XPUT 'http://localhost:9200/test/file/2' -d '{
"name" : "filte2",
"hash" : "62108f16c7d809f960d745b446d91a08"
}'

How I can search into dir type all dir where "name=dir*" and hash is into
file type ?

Thanks.


(David Pilato) #3

What I would probably do is to index documents in another way:

{
"name" : "file1",
"dirname" : "dir1"
}

Then, it's easy to search for a file.

If it doesn't fit to your needs, then have a look at nested or parent/child
concepts. I don't use it myself so I can't help you more than that here.

What is exactly your use case?

HTH
David.

Le 6 août 2012 à 11:48, elasticuser merik2004-elastic@yahoo.fr a écrit :

Hello,

Someone has an idea ?

Thanks.

On Wednesday, August 1, 2012 12:58:29 PM UTC+2, elasticuser wrote:

Hello,

In this example :

$ curl -XPUT ' http://localhost:9200/test/dir/1' -d '{
"name" : "dir1",
"hash" : "11a3e229084349bc25d97e29393ced1d"
}'
$ curl -XPUT ' http://localhost:9200/test/dir/1
http://localhost:9200/test/dir/2' -d '{
"name" : "dir2",
"hash" : "61a1d3d61d5c3f134006f9302b1e4775"
}'
$ curl -XPUT ' http://localhost:9200/test/dir/2
http://localhost:9200/test/dir/3' -d '{
"name" : "test1",
"hash" : "3e7705498e8be60520841409ebc69bc1"
}'

$ curl -XPUT ' http://localhost:9200/test/dir/3
http://localhost:9200/test/file/1' -d '{
"name" : "file1",
"hash" : "11a3e229084349bc25d97e29393ced1d"
}'
$ curl -XPUT ' http://localhost:9200/test/file/1
http://localhost:9200/test/file/2' -d '{
"name" : "filte2",
"hash" : "62108f16c7d809f960d745b446d91a08"
}'

How I can search into dir type all dir where "name=dir*" and hash is into
file type ?

Thanks.

 <http://localhost:9200/test/file/2>

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


(elasticuser-2) #4

Hello David,

Thanks for your answer.

I would like to do the same thing that a join request :

select * from dir,file where dir.name like 'dir%' and dir.hash = file.hash;

I will see the parent/child concepts.

Thanks.

On Monday, August 6, 2012 2:43:25 PM UTC+2, David Pilato wrote:

What I would probably do is to index documents in another way:

{
"name" : "file1",
"dirname" : "dir1"
}

Then, it's easy to search for a file.

If it doesn't fit to your needs, then have a look at nested or
parent/child concepts. I don't use it myself so I can't help you more than
that here.

What is exactly your use case?

HTH

David.

Hello,

Someone has an idea ?

Thanks.

On Wednesday, August 1, 2012 12:58:29 PM UTC+2, elasticuser wrote:

Hello,

In this example :

$ curl -XPUT ' http://localhost:9200/test/dir/1' -d '{
"name" : "dir1",
"hash" : "11a3e229084349bc25d97e29393ced1d"
}'
$ curl -XPUT ' http://localhost:9200/test/dir/1 http://localhost:9200/test/dir/2'
-d '{
"name" : "dir2",
"hash" : "61a1d3d61d5c3f134006f9302b1e4775"
}'
$ curl -XPUT ' http://localhost:9200/test/dir/2 http://localhost:9200/test/dir/3'
-d '{
"name" : "test1",
"hash" : "3e7705498e8be60520841409ebc69bc1"
}'

$ curl -XPUT ' http://localhost:9200/test/dir/3 http://localhost:9200/test/file/1'
-d '{
"name" : "file1",
"hash" : "11a3e229084349bc25d97e29393ced1d"
}'
$ curl -XPUT ' http://localhost:9200/test/file/1 http://localhost:9200/test/file/2'
-d '{
"name" : "filte2",
"hash" : "62108f16c7d809f960d745b446d91a08"
}'

How I can search into dir type all dir where "name=dir*" and hash is into
file type ?

Thanks.

http://localhost:9200/test/file/2

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


(David Pilato) #5

Yes I understand that but IMHO you should keep in mind that you are now in a
NoSQL world.
That means that you should not think as before with SQL (relationnal) world.

So, it's best to persist your documents with full data not with relationship
between documents.
Or, if you really need to, then have a look at parent/child.

My 2 cents
David.

Le 6 août 2012 à 15:35, elasticuser merik2004-elastic@yahoo.fr a écrit :

Hello David,

Thanks for your answer.

I would like to do the same thing that a join request :

select * from dir,file where dir.name like 'dir%' and dir.hash = file.hash;

I will see the parent/child concepts.

Thanks.

On Monday, August 6, 2012 2:43:25 PM UTC+2, David Pilato wrote:

What I would probably do is to index documents in another way:

{
"name" : "file1",
"dirname" : "dir1"
}

Then, it's easy to search for a file.

If it doesn't fit to your needs, then have a look at nested or
parent/child concepts. I don't use it myself so I can't help you more than
that here.

What is exactly your use case?

HTH
David.

> > > Hello,
Someone has an idea ?

Thanks.

On Wednesday, August 1, 2012 12:58:29 PM UTC+2, elasticuser wrote:
  > > > > Hello,
  In this example :

  $ curl -XPUT ' http://localhost:9200/test/dir/1' -d '{
      "name" : "dir1",
      "hash" : "11a3e229084349bc25d97e29393ced1d"
  }'
  $ curl -XPUT ' <http://localhost:9200/test/dir/1>

http://localhost:9200/test/dir/2' -d '{
"name" : "dir2",
"hash" : "61a1d3d61d5c3f134006f9302b1e4775"
}'
$ curl -XPUT ' http://localhost:9200/test/dir/2
http://localhost:9200/test/dir/3' -d '{
"name" : "test1",
"hash" : "3e7705498e8be60520841409ebc69bc1"
}'

  $ curl -XPUT ' <http://localhost:9200/test/dir/3>

http://localhost:9200/test/file/1' -d '{
"name" : "file1",
"hash" : "11a3e229084349bc25d97e29393ced1d"
}'
$ curl -XPUT ' http://localhost:9200/test/file/1
http://localhost:9200/test/file/2' -d '{
"name" : "filte2",
"hash" : "62108f16c7d809f960d745b446d91a08"
}'

  How I can search into dir type all dir where "name=dir*" and hash

is into file type ?

  Thanks.

    <http://localhost:9200/test/file/2>
> > > 

--
David Pilato
http://localhost:9200/test/file/2
http://www.scrutmydocs.org/ http://www.scrutmydocs.org/
http://dev.david.pilato.fr/ http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--
David Pilato
http://www.scrutmydocs.org/
http://dev.david.pilato.fr/
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


(elasticuser-2) #6

OK, thanks for your help David.


(system) #7