Way to get all Index Types for Index


(Nicholas Padilla) #1

Hello!

I am working on integrating ES into a java application that takes
generic json and indexing it for search. The json represents
different forms that users interact with and follow a uniform keys
pattern, so will make searching over data an easy task. However, the
actual schema will be different per form and since ES can work schema-
less I decided to use ES. I have already got the data indexed and am
running searches over that data. I want to create some search forms
dynamically based on the Index Type, I am creating many index types
per index - basically one index type per form.

So having said all that, I would like to get all index types for an
index. I can then query one record for each index type and get all
fields for the type to build the Search Form. I want the app to
remain schema-less so we can handle all forms they decide to build in
the future. Any ideas or tips/hints that can point me in the right
direction. I have looked at the java api and queried the forums about
this topic but haven't found anything that would do what I am looking
for.

My only idea at this point would be to index the json schema in a
separate index. I would get the schema by parsing the json when
indexing, then add the fields to the index typed again on the form.
This way I can always easily get at the form fields. If this is the
only way to do what I am looking for then I can take that approach.
However, I would like to see if there are any more graceful ways of
handling this scenario.

Thanks for the help, and reading this far!


(Shay Banon) #2

Use the get mapping API when you use REST, or the cluster state API when
you use the Java API (here is how it is used in the REST get mapping
endpoint:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java#L66
.

On Tue, Dec 13, 2011 at 7:49 PM, Nicholas Padilla <
nicholas@monstersoftwarellc.com> wrote:

Hello!

I am working on integrating ES into a java application that takes
generic json and indexing it for search. The json represents
different forms that users interact with and follow a uniform keys
pattern, so will make searching over data an easy task. However, the
actual schema will be different per form and since ES can work schema-
less I decided to use ES. I have already got the data indexed and am
running searches over that data. I want to create some search forms
dynamically based on the Index Type, I am creating many index types
per index - basically one index type per form.

So having said all that, I would like to get all index types for an
index. I can then query one record for each index type and get all
fields for the type to build the Search Form. I want the app to
remain schema-less so we can handle all forms they decide to build in
the future. Any ideas or tips/hints that can point me in the right
direction. I have looked at the java api and queried the forums about
this topic but haven't found anything that would do what I am looking
for.

My only idea at this point would be to index the json schema in a
separate index. I would get the schema by parsing the json when
indexing, then add the fields to the index typed again on the form.
This way I can always easily get at the form fields. If this is the
only way to do what I am looking for then I can take that approach.
However, I would like to see if there are any more graceful ways of
handling this scenario.

Thanks for the help, and reading this far!


(Nicholas Padilla) #3

Hey Shay,

That worked like a charm!

Thanks for your time!

On Dec 13, 3:39 pm, Shay Banon kim...@gmail.com wrote:

Use the get mapping API when you use REST, or the cluster state API when
you use the Java API (here is how it is used in the REST get mapping
endpoint:https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j...
.

On Tue, Dec 13, 2011 at 7:49 PM, Nicholas Padilla <

nicho...@monstersoftwarellc.com> wrote:

Hello!

I am working on integrating ES into a java application that takes
generic json and indexing it for search. The json represents
different forms that users interact with and follow a uniform keys
pattern, so will make searching over data an easy task. However, the
actual schema will be different per form and since ES can work schema-
less I decided to use ES. I have already got the data indexed and am
running searches over that data. I want to create some search forms
dynamically based on the Index Type, I am creating many index types
per index - basically one index type per form.

So having said all that, I would like to get all index types for an
index. I can then query one record for each index type and get all
fields for the type to build the Search Form. I want the app to
remain schema-less so we can handle all forms they decide to build in
the future. Any ideas or tips/hints that can point me in the right
direction. I have looked at the java api and queried the forums about
this topic but haven't found anything that would do what I am looking
for.

My only idea at this point would be to index the json schema in a
separate index. I would get the schema by parsing the json when
indexing, then add the fields to the index typed again on the form.
This way I can always easily get at the form fields. If this is the
only way to do what I am looking for then I can take that approach.
However, I would like to see if there are any more graceful ways of
handling this scenario.

Thanks for the help, and reading this far!


(system) #4