Index

classic Classic list List threaded Threaded
8 messages Options
javastuff.sam@gmail.com javastuff.sam@gmail.com
Reply | Threaded
Open this post in threaded view
|

Index

Hi,

How to check index is created? How many indexes are present? What is the definition of index?

Thanks,
--Sambhav
dkarachentsev dkarachentsev
Reply | Threaded
Open this post in threaded view
|

Re: Index

Hi Sambhav,

You may find created indexes using web-console [1].

[1] https://ignite.apache.org/addons.html#web-console

-Dmitry
Alexey Kuznetsov Alexey Kuznetsov
Reply | Threaded
Open this post in threaded view
|

Re: Index

See attached screenshot - how to check indexes.
javastuff.sam@gmail.com javastuff.sam@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Index

Webconsole is the only way? Visor or JMX or logs or sample JAVA API.
Alexey Kuznetsov-2 Alexey Kuznetsov-2
Reply | Threaded
Open this post in threaded view
|

Re: Index

Hi!

You may try to use 

2) org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask (or see how it is implemented).
But, PLEASE NOTE, this is internal API and may be changed in future versions of Ignite.


On Tue, Apr 18, 2017 at 12:42 AM, [hidden email] <[hidden email]> wrote:
Webconsole is the only way? Visor or JMX or logs or sample JAVA API.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Index-tp11969p12004.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.



--
Alexey Kuznetsov
javastuff.sam@gmail.com javastuff.sam@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Index

I tried REST API and H2 debug console. Do not see index, not sure what is wrong.

I am creating cache pragmatically and can not use annotations. Below is the sample based on CacheQueryExample.java. Removed annotations from Person.java to create Person2.java

 
           CacheConfiguration<Long, Person2> personCacheCfg = new CacheConfiguration<>(PERSON_CACHE);
            personCacheCfg.setCacheMode(CacheMode.PARTITIONED);
            Collection<String> indx_fields = new ArrayList<>();
            indx_fields.add("salary");
            LinkedHashMap<String,String> fields = new LinkedHashMap<>();
            fields.put("id",Long.class.getName());
            fields.put("salary",Double.class.getName());
            QueryIndex idx = new QueryIndex();
            idx.setName("SALARY_IDX");
            idx.setFieldNames(indx_fields, true);
            Collection<QueryIndex> idxCollection = new ArrayList<>();
            idxCollection.add(idx);
            QueryEntity ent = new QueryEntity();
            ent.setKeyType(Long.class.getName());
            ent.setValueType(Person2.class.getName());
            Collection<QueryEntity> entCollection = new ArrayList<>();
            ent.setIndexes(idxCollection);
            ent.setFields(fields);
            entCollection.add(ent);
            personCacheCfg.setQueryEntities(entCollection);
            IgniteCache<Long, Person2> personCache = ignite.getOrCreateCache(personCacheCfg);


With this I was expecting to see index named SALARY_IDX on column SALARY.
Can you hep identifying the issue here?

Thanks,
-Sam
javastuff.sam@gmail.com javastuff.sam@gmail.com
Reply | Threaded
Open this post in threaded view
|

Re: Index

Resolved it!

I used default constructor for QueryIndex and missed setting IndexType. This resulted into missing index.
Added "idx.setIndexType(QueryIndexType.SORTED)", able to see index on H2 debug console.

What is the default IndexType?
Is it expected to not throw error when IndexType is not set and ignore index creation? With default constructor this is likely to happen.

Thanks,
-Sam
Andrew Mashenkov Andrew Mashenkov
Reply | Threaded
Open this post in threaded view
|

Re: Index

Hi Sam,

Default is 'null' obviously, it is by bad design and here is a ticket [1].
It is already fixed in 2.0, where index is SORTED by default. 



On Fri, Apr 21, 2017 at 10:00 PM, [hidden email] <[hidden email]> wrote:
Resolved it!

I used default constructor for QueryIndex and missed setting IndexType. This
resulted into missing index.
Added /"idx.setIndexType(QueryIndexType.SORTED)"/, able to see index on H2
debug console.

What is the default IndexType?
Is it expected to not throw error when IndexType is not set and ignore index
creation? With default constructor this is likely to happen.

Thanks,
-Sam



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Index-tp11969p12162.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.



--
Best regards,
Andrey V. Mashenkov
Regards,
Andrew.