Search on multidimensional array


(narinder.izap) #1

Hi

 I want to search a* multidimensional array element*. How to access it 

in elasticsearch. As for example:

id_like : [
{
"id" : 777,
"title":"abc"
},
{
"id" : 597,
"title":"xyz"
}
]

Now I want to search the document with id and sort by title. so can you
please tell me how to query it?


(Karussell) #2

you'll need to index it as separate documents:

{
"id" : 777,
"title":"abc"
}

Then you can get one document via
curl -XGET http://localhost:9200/docs/doc/777

or sort by title:
curl -XPOST 'http://localhost:9200/docs/doc/_search -d '
{ "sort": { "title" : "desc" },
"query":{"match_all":{}}}
}'

Peter.

On 3 Nov., 08:17, Narinder Kaur narinder.k...@izap.in wrote:

Hi

 I want to search a* multidimensional array element*. How to access it

in elasticsearch. As for example:

id_like : [
{
"id" : 777,
"title":"abc"},

{
"id" : 597,
"title":"xyz"}

]

Now I want to search the document with id and sort by title. so can you
please tell me how to query it?


(system) #3