Querying for populated field mappings given a specific field/value

Hi All,

I'd like to inspect the _mapping of given a specific field/value in an ES
index of a specific type. The way we set up our data (due to design of
nesting/parent-child relationships) was to put them all under one type,
then have a subType field. Unfortunately, as data is indexed and the
_mapping schema dynamically builds out, the _mapping shows all the possible
fields of that type, and I can't query or filter the _mapping. This makes
sense (_mapping is more of a config schema file per se, not a search API as
I understand it), but is there any workaround that could give us the
desired result? Here is an example:

index: Farm
type: Animal

So localhost:9200/Farm/Animal/_mapping retrieves the mapping. But in our
data we have a field animalType. I want to get the 'populated' fields, i.e.
the dynamically built mappings file, but only when animalType is Cow, for
instance.

A clear workaround is to redesign our data and index to look like
/Farm/Cow, /Farm/Sheep, in which case /Farm/Cow/_mapping would return the
desired fields for the Cow type. But that disrupts other aspects of our
data design due for maintaining parent-children.

Is it possible to query/generate a field list when we have Farm/Animal and
animalType is Cow, without scanning all data? Sort of like a facets query,
where the facet is on the field names (instead of a specific field), the
counts being how often they are used! It would be like faceting on the
schema, if it were searchable. Sorry if that's confusing!

Thanks for any ideas!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

On the top of my head I do not think that this is possible. The reason for
this is, that the type is just another metadata field in the data
structure, which is used to store the indexed documents. On that level we
do not have any type information, as all documents regardless of its type
of an index are stored in that data structure.

I also dont have any awesome idea to work around that at the moment.

--Alex

On Tue, Nov 12, 2013 at 11:47 PM, Andrew Anderson picasandrew@gmail.comwrote:

Hi All,

I'd like to inspect the _mapping of given a specific field/value in an ES
index of a specific type. The way we set up our data (due to design of
nesting/parent-child relationships) was to put them all under one type,
then have a subType field. Unfortunately, as data is indexed and the
_mapping schema dynamically builds out, the _mapping shows all the possible
fields of that type, and I can't query or filter the _mapping. This makes
sense (_mapping is more of a config schema file per se, not a search API as
I understand it), but is there any workaround that could give us the
desired result? Here is an example:

index: Farm
type: Animal

So localhost:9200/Farm/Animal/_mapping retrieves the mapping. But in our
data we have a field animalType. I want to get the 'populated' fields, i.e.
the dynamically built mappings file, but only when animalType is Cow, for
instance.

A clear workaround is to redesign our data and index to look like
/Farm/Cow, /Farm/Sheep, in which case /Farm/Cow/_mapping would return the
desired fields for the Cow type. But that disrupts other aspects of our
data design due for maintaining parent-children.

Is it possible to query/generate a field list when we have Farm/Animal and
animalType is Cow, without scanning all data? Sort of like a facets query,
where the facet is on the field names (instead of a specific field), the
counts being how often they are used! It would be like faceting on the
schema, if it were searchable. Sorry if that's confusing!

Thanks for any ideas!

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.