Elasticsearch: Handling JSONs with arrays -


i have large json many fields contain arrays. 1 field "top" contains many fields: "middle1", "middle2", "middle3". each of these "middle" fields contains array. there simple way search every element within middle1 , return individual elements? when try "middle1.description":"blahblahblah" in query match, elasticsearch returns of middle1. i've tried changing default mapping elasticsearch nested , tells me:

[object mapping [middle1] can't changed non-nested nested] 

i'm @ loss here.

also, if es search through of these arrays , return individual elements match, fantastic.

you can make backward compatible changes mapping. that's why error when trying change type of object nested. should reindex document , create nested type upfront, before indexing document. can either submit mapping through create index api while creating index or update afterwards using put mapping api.

even using nested documents, going whole document indexed. nested type allows make distinction between different children , return proper matches, belong same child. that's useful when mapping 1 many relations , make multiple queries on children @ same time. have @ following articles know more:

http://euphonious-intuition.com/2013/02/managing-relations-in-elasticsearch/ http://www.spacevatican.org/2012/6/3/fun-with-elasticsearch-s-children-and-nested-documents/

as mentioned in article parent/child alternative nested documents, less performant more flexible. parents , children can indeed independently , can either retrieve children querying parents or parents querying children.

i'm not sure though if parent/child going helpful in case, if problem return matching children.


Comments