PrepareSearch in selected Indices


(vijuitech) #1

Hi,

I have the indices namely 1990, 2000, 2006 and Variance in a same
Folder. Here Variance Index is different Json.

How can I search only 1990, 2000, 2006 Index alone and not using
the Index Variance using prepareSearch?

I am using the code:

SearchRequestBuilder searchRequestBuilder = client.prepareSearch(" ");
searchRequestBuilder.setSearchType(SearchType.QUERY_THEN_FETCH);
response = searchRequestBuilder.execute().actionGet();

Cheers!!

George


(Shay Banon) #2

prepareSearch("1990", "2000", "2006")....

On Mon, Mar 26, 2012 at 12:25 PM, George Viju vijuitech@gmail.com wrote:

Hi,

I have the indices namely 1990, 2000, 2006 and Variance in a same
Folder. Here Variance Index is different Json.

How can I search only 1990, 2000, 2006 Index alone and not using
the Index Variance using prepareSearch?

I am using the code:

SearchRequestBuilder searchRequestBuilder = client.prepareSearch(" ");
searchRequestBuilder.setSearchType(SearchType.QUERY_THEN_FETCH);
response = searchRequestBuilder.execute().actionGet();

Cheers!!

George


(vijuitech) #3

Thanks Shay....

If in future it may create 2007,2008... indices, Is there any other
way to select and search the indices dynamically? Is there any other
method to search the Indices dynamically ignoring the Variance Index?
Is there any other method to find the indices(to check what are the
indices available) in the in the indices folder?

Thanks!!

George

On Mar 27, 6:07 pm, Shay Banon kim...@gmail.com wrote:

prepareSearch("1990", "2000", "2006")....

On Mon, Mar 26, 2012 at 12:25 PM, George Viju vijuit...@gmail.com wrote:

Hi,

I have the indices namely 1990, 2000, 2006 and Variance in a same
Folder. Here Variance Index is different Json.

How can I search only 1990, 2000, 2006 Index alone and not using
the Index Variance using prepareSearch?

I am using the code:

SearchRequestBuilder searchRequestBuilder = client.prepareSearch(" ");
searchRequestBuilder.setSearchType(SearchType.QUERY_THEN_FETCH);
response = searchRequestBuilder.execute().actionGet();

Cheers!!

George


(Thomas Peuss) #4

Hi George!

Am Mittwoch, 28. März 2012 05:59:42 UTC+2 schrieb George Viju:

If in future it may create 2007,2008... indices, Is there any other
way to select and search the indices dynamically? Is there any other
method to search the Indices dynamically ignoring the Variance Index?
Is there any other method to find the indices(to check what are the
indices available) in the in the indices folder?

You can use curl -XGET 'http://localhost:9200/_status' to get the list of
all indices that exist...

CU
Thomas


(Thomas Peuss) #5

Hi George!

Am Mittwoch, 28. März 2012 05:59:42 UTC+2 schrieb George Viju:

Thanks Shay....

If in future it may create 2007,2008... indices, Is there any other
way to select and search the indices dynamically? Is there any other
method to search the Indices dynamically ignoring the Variance Index?
Is there any other method to find the indices(to check what are the
indices available) in the in the indices folder?

In Java-Code:
IndicesStatusRequestBuilder
isrb=ElasticSearchController.getClient().admin().indices().prepareStatus();
IndicesStatusResponse rsp=isrb.execute().actionGet();

    List<String> response=new ArrayList<String>();
    for (String indexName : rsp.indices().keySet()) {
        response.add(indexName);
    }
    Collections.sort(response);
    return response;

CU
Thomas


(vijuitech) #6

Thank you so much Thomas!!

Cheers!!

George

On Mar 28, 12:01 pm, Thomas Peuss thomas.pe...@nterra.com wrote:

Hi George!

Am Mittwoch, 28. März 2012 05:59:42 UTC+2 schrieb George Viju:

Thanks Shay....

If in future it may create 2007,2008... indices, Is there any other
way to select and search the indices dynamically? Is there any other
method to search the Indices dynamically ignoring the Variance Index?
Is there any other method to find the indices(to check what are the
indices available) in the in the indices folder?

In Java-Code:
IndicesStatusRequestBuilder
isrb=ElasticSearchController.getClient().admin().indices().prepareStatus();
IndicesStatusResponse rsp=isrb.execute().actionGet();

    List<String> response=new ArrayList<String>();
    for (String indexName : rsp.indices().keySet()) {
        response.add(indexName);
    }
    Collections.sort(response);
    return response;

CU
Thomas


(Shay Banon) #7

I don't recommend using the status request to get the list of indices, use
the cluster state API, its more lightweight.

On Wed, Mar 28, 2012 at 9:25 AM, George Viju vijuitech@gmail.com wrote:

Thank you so much Thomas!!

Cheers!!

George

On Mar 28, 12:01 pm, Thomas Peuss thomas.pe...@nterra.com wrote:

Hi George!

Am Mittwoch, 28. März 2012 05:59:42 UTC+2 schrieb George Viju:

Thanks Shay....

If in future it may create 2007,2008... indices, Is there any other
way to select and search the indices dynamically? Is there any other
method to search the Indices dynamically ignoring the Variance Index?
Is there any other method to find the indices(to check what are the
indices available) in the in the indices folder?

In Java-Code:
IndicesStatusRequestBuilder

isrb=ElasticSearchController.getClient().admin().indices().prepareStatus();

    IndicesStatusResponse rsp=isrb.execute().actionGet();

    List<String> response=new ArrayList<String>();
    for (String indexName : rsp.indices().keySet()) {
        response.add(indexName);
    }
    Collections.sort(response);
    return response;

CU
Thomas


(vijuitech) #8

ok. Thank you so much Shay!

cheers!

George

On Mar 28, 1:56 pm, Shay Banon kim...@gmail.com wrote:

I don't recommend using the status request to get the list of indices, use
the cluster state API, its more lightweight.

On Wed, Mar 28, 2012 at 9:25 AM, George Viju vijuit...@gmail.com wrote:

Thank you so much Thomas!!

Cheers!!

George

On Mar 28, 12:01 pm, Thomas Peuss thomas.pe...@nterra.com wrote:

Hi George!

Am Mittwoch, 28. März 2012 05:59:42 UTC+2 schrieb George Viju:

Thanks Shay....

If in future it may create 2007,2008... indices, Is there any other
way to select and search the indices dynamically? Is there any other
method to search the Indices dynamically ignoring the Variance Index?
Is there any other method to find the indices(to check what are the
indices available) in the in the indices folder?

In Java-Code:
IndicesStatusRequestBuilder

isrb=ElasticSearchController.getClient().admin().indices().prepareStatus();

    IndicesStatusResponse rsp=isrb.execute().actionGet();
    List<String> response=new ArrayList<String>();
    for (String indexName : rsp.indices().keySet()) {
        response.add(indexName);
    }
    Collections.sort(response);
    return response;

CU
Thomas


(system) #9