How to list SolrCloud aliases? - solrcloud

In SolrCloud Collections API (https://cwiki.apache.org/confluence/display/solr/Collections+API), we can list collections using action:
/admin/collections?action=LIST
However, aliases are not included in this list. There is also no corresponding command for aliases (we can only CREATEALIAS or DELETEALIAS). How to list aliases?

This feature seems to be not implemented yet: https://issues.apache.org/jira/browse/SOLR-4968
However, you can use this command:
/admin/collections?action=CLUSTERSTATUS
Each collection will be listed together with the aliases it is covered by. Also in the bottom of the XML there is a separate node, summarising all aliases and covered collections.

The aliases list can be fetched in json format using the following command.
[solr_server_hostname]:8983/solr/zookeeper?detail=true&path=/aliases.json
The "data" field in this JSON holds the list of collections object.

For Solr 6.6+, you could use:
/solr/admin/collections?action=LISTALIASES
See https://solr.apache.org/guide/6_6/collections-api.html#CollectionsAPI-listaliases

Related

How do I read and write to the google cloud datastore?

The documentation in google cloud's datastore section is very confusing to me.
I was under the belief datastore may be used as a key-value storage. (Similar to mongoDB) But I guess I misunderstood how its keys work, since I can't use string keys outright, but I need to transform series of strings to a (list) key via some list => dataStore.key(list) transformation.
That's weird, and I don't understand why use a list instead of a string, and I don't understand why I don't use the list outright, and need to use datastore.key first, but I can do that. However, after playing with it a little bit, I discovered that the return value of datastore.key(list) would get me different values for the same list if I run it repeatedly!
So, now I need to somehow remember this key somewhere, but the reason I wanted to use datastore was that I was running in a service with no persistent memory to begin with.
Am I using datastore wrong? Can I use it at all for simple persistent key-value storage?
It appears that the issue was that I used a list that was too short.
The datastore expects collections, which contain documents, each of which is a key-value mapping. So instead of having my key point at a mapping, I needed to set a collection, and in it have keys mapped to mappings. (In other words, I needed to have one more element in the keys list)
results = await this.dataStore.get(this.dataStore.key([collectionId, documentId]));
AND
await this.dataStore.save({ key: this.dataStore.key([collectionId, documentId]), data: someKeyValueObject });

Can MLCP read input based on a condition

In marklogic, using MLCP can we read /export/import/copy data based on a condition?
Example : read only files with students subject element has only maths
Yes, you can apply the -query_filter option to restrict documents to those matching the filter query.
https://docs.marklogic.com/guide/mlcp/export#id_66898
The -query_filter option accepts a serialized XML cts:query or JSON cts.query as its value.
Controlling What is Exported, Copied, or Extracted
By default, mlcp exports all documents or all documents and metadata in the database, depending on whether you are exporting in document or archive format or copying the database. Several command line options are available to enable customization.
-query_filter - export/copy only documents matched by the specified cts query. You can use this option alone or in combination with a directory, collection or document selector filter.
-directory_filter - export only the documents in the listed database directories. You cannot use this option with -collection_filter or -document-selector.
-collection_filter - export only the documents in the listed collections. You cannot use this option with -directory_filter or -document_selector.
-document_selector export only documents selected by the specified XPath expression. You cannot use this option with -directory_filter or -collection_filter. Use -path_namespace to define namespace prefixes.

what happens if i don't specify the collection name in Corb

I have a corb script to run node replace on the xml files.
If I don't specify the collection, will it remove the documents from the existing collections?
If you are altering the document with xdmp:node-replace(), then the document will remain in it's collections and you do not need to worry about setting/adding it back.
If you are using xdmp:document-insert() to replace the document at the current URI, then you do need to specify the collection(s), otherwise it will be removed from the existing collections.
However, you can use xdmp:document-get-collections() to retrieve the sequence of collections for the URI and use it for the 4th parameter of xdmp:document-insert()
xdmp:document-insert($URI, $doc, (), xdmp:document-get-collections($URI))
Its better to provide an empty collection value, while doing the node-replace so it doesn't alter the existing collections of the document. Not defining this attribute is throwing errors while running the script.

How to model Not In query in Couch DB [duplicate]

Folks, I was wondering what is the best way to model document and/or map functions that allows me "Not Equals" queries.
For example, my documents are:
1. { name : 'George' }
2. { name : 'Carlin' }
I want to trigger a query that returns every documents where name not equals 'John'.
Note: I don't have all possible names before hand. So the parameters in query can be any random text like 'John' in my example.
In short: there is no easy solution.
You have four options:
sending a multi range query
filter the view response with a server-side list function
using a CouchDB plugin
use the mango query language
sending a multi range query
You can request the view with two ranges defined by startkey and endkey. You have to choose the range so, that the key John is not requested.
Unfortunately you have to find the commit request that somewhere exists and compile your CouchDB with it. Its not included in the official source.
filter the view response with a server-side list function
Its not recommended but you can use a list function and ignore the row with the key John in your response. Its like you will do it with a JavaScript array.
using a CouchDB plugin
Create an additional index with e.g. couchdb-lucene. The lucene server has such query capabilities.
use the "mango" query language
Its included in the CouchDB 2.0 developer preview. Not ready for production but will be definitely included in the stable release.

boto DynamoDb query/scan ProjectionExpression syntax?

From the documentation, it says "By default, a Scan returns all of the data attributes for every item; however, you can use the ProjectionExpression parameter so that the Scan only returns some of the attributes, rather than all of them."
I am wondering if anyone knows what's the syntax for using the ProjectionExpression parameter with boto?
For example I have
leagueTable = Table('leagues', schema=[HashKey('leagueId', data_type=NUMBER)]
I want to use the ProjectionExpression parameter to scan the table and only get back the selected field.
According to the documentation at http://docs.pythonboto.org/en/latest/ref/dynamodb2.html#boto.dynamodb2.table.Table.scan , the attributes parameter will allow you to specify a tuple of attributes and only return those attributes in the result set.
However, this uses the AttributesToGet API, instead of the newer ProjectionExpression API you are referring to. ProjectionExpression will allow you to retrieve individual list or map elements. To use ProjectionExpression, you would have to use the low-level API for boto, which matches the low-level DynamoDB API closely. The scan documentation for this can be found at: http://docs.pythonboto.org/en/latest/ref/dynamodb2.html#boto.dynamodb2.layer1.DynamoDBConnection.scan
Hope that helps, good luck!

Resources