# Query with elasticsearch and jcard json (array of array mapping)

**URL:** <https://discuss.elastic.co/t/query-with-elasticsearch-and-jcard-json-array-of-array-mapping/24260>\
**Category:** Elasticsearch\
**Created:** [June 24, 2015, 12:33pm UTC](https://discuss.elastic.co/t/query-with-elasticsearch-and-jcard-json-array-of-array-mapping/24260 "2015-06-24T12:33:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rikribbers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rikribbers/32/3453_2.png) [@rikribbers](https://discuss.elastic.co/u/rikribbers)\
**Post date:** [June 24, 2015, 12:33pm UTC](https://discuss.elastic.co/t/query-with-elasticsearch-and-jcard-json-array-of-array-mapping/24260/1 "2015-06-24T12:33:32Z")

</div>

I have a data set containing vcards based on the JSON Jcard Mapping ([RFC 7095 - jCard: The JSON Format for vCard](https://tools.ietf.org/html/rfc7095)) The problem is that I want to search on the 'fn' field only.

The vcard data has the following format. As you can see the value don't have the "traditional" "key":"value" structure but an array with several value of which the first happen to be the key for that array.

["vcard",  
[  
["version", {}, "text", "4.0"],  
["fn", {}, "text", "John Doe"],  
["gender", {}, "text", "M"],  
["categories", {}, "text", "computers", "cameras"],  
...  
]  
]  
I'm creating a vcard document like this

> curl -X POST localhost:9200/vcards/id1 -d '{  
> "id":"id1",  
> "vcardArray" : ["vcard",  
> [  
> ["version", {}, "text", "4.0"],  
> ["fn", {}, "text", "John Doe"],  
> ["gender", {}, "text", "M"]  
> ]  
> ],  
> "status":["registered"]  
> }'  
> Normally I would create a specific mapping so when the document is analysed a new index is created and searching for a fn field would look something like this....

curl -v -X POST [http://localhost:9200/vcards/\_search](http://localhost:9200/vcards/_search) -d '{ "query" :  
{ "bool" : { "must": { "match" : {  
"vcardArray.vcard.fn" :  
{ "query" : "Rik Ribbers" , "type" : "phrase" }  
} } } }  
}'  
A potential mapping would look like this, but this one is not working

> curl -X PUT [http://localhost:9200/vcards](http://localhost:9200/vcards) -d '  
> {  
> "mappings": {  
> "vcardArray" : {  
> "type" : "nested",  
> "properties" : {  
> "vcard" : {  
> "type" : "index",  
> "index" : "not\_analyzed"  
> }  
> }  
> }  
> }  
> }'  
> Any pointer to the correct mapping or query would be helpful.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:05am UTC](https://discuss.elastic.co/t/query-with-elasticsearch-and-jcard-json-array-of-array-mapping/24260/2 "2017-07-06T00:05:38Z")

</div>

Closed on July 6, 2017, 12:05am UTC


