I'm doing the most basic of solr queries with faceting.
q=*:*&facet=true&facet.field=year
And I'm getting an error as follows:
{
"responseHeader": {
"status": 400,
"QTime": 1,
"params": {
"indent": "true",
"q": "*:*&facet=true&facet.field=year",
"_": "1443134591151",
"wt": "json"
}
},
"error": {
"msg": "undefined field *",
"code": 400
}
}
This query is straight out of the online tutorials. Why is solr complaining?
It appears that what you have done is gone to the Solr Admin panel and in the query section you have put
*:*&facet=true&facet.field=year
after the q. What you need to do is put *:* after the q, and facet=true&facet.field=year under Raw Query Parameters.
The error says, that you have "undefined field". Is "year" field defined in your schema? Also, can you give details about how you are querying the data. Like which client?And I assume that q=: is working and issue is only with faceting
You've put it into the wrong line in the solr admin.
Just take the same line, and paste it into the Raw query line instead of the query line.
Related
For some of our collections when we run a Collections API DELETE synchronously followed immediately by a Configset API DELETE for the underlying configset we end up with a messed up collection state.
I have been unable to reproduce this issue in a test environment, it only happens on the live production instances inconsistently, so it may be load/race condition related.
Running a COLSTATUS against the broken collection provides the following response,
{
"responseHeader": {
"status": 404,
"QTime": 33
},
"collection_19744": {
"stateFormat": 2,
"znodeVersion": 51,
"properties": {
"autoAddReplicas": "false",
"maxShardsPerNode": "1",
"nrtReplicas": "3",
"pullReplicas": "0",
"replicationFactor": "3",
"router": {
"name": "compositeId"
},
"tlogReplicas": "0"
},
"activeShards": 1,
"inactiveShards": 0
},
"error": {
"metadata": [
"error-class",
"org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException",
"root-error-class",
"org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException"
],
"msg": "Error from server at http://solr1.prod-internal:8983/solr/collection_19744_shard1_replica_n4: Expected mime type application/octet-stream but got text/html. <html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"/>\n<title>Error 404 Not Found</title>\n</head>\n<body><h2>HTTP ERROR 404</h2>\n<p>Problem accessing /solr/collection_19744_shard1_replica_n4/admin/segments. Reason:\n<pre> Not Found</pre></p>\n</body>\n</html>\n",
"code": 404
}
}
The underlying shard data for the collection has been successfully removed from disk and is not present on any of the solr nodes, the /collections/collection_19744 node has also been successfully deleted from Zookeeper, which I tested using the zkcli script. Receiving a NoNode for /collections/collection_19744 message.
As the COLSTATUS is broken we cannot delete the associated configset, doing so results in a "Can not delete ConfigSet as it is currently being used by collection [collection_19744]" message. Which is false.
Where exactly does the COLSTATUS get its collection meta information, as the /collections/collection_19744 node is absent in zookeeper?
I want to remove the broken collection metadata so I can then remove the configset and recreate the collection with the original naming.
I would like to add some custom data to emails and to be able to filter them by using GraphAPI.
So far, I was able to create a Schema Extension and it gets returned successfully when I query https://graph.microsoft.com/v1.0/schemaExtensions/ourdomain_EmailCustomFields:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#schemaExtensions/$entity",
"id": "ourdomain_EmailCustomFields",
"description": "Custom data for emails",
"targetTypes": [
"Message"
],
"status": "InDevelopment",
"owner": "hiding",
"properties": [
{
"name": "MailID",
"type": "String"
},
{
"name": "ProcessedAt",
"type": "DateTime"
}
]
}
Then I patched a specific message https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/Messages/hidingmessageid:
PATCH Request
{"ourdomain_EmailCustomFields":{"MailID":"12","ProcessedAt":"2020-05-27T16:21:19.0204032-07:00"}}
The problem is that when I select the message, the added custom data doesn't appear by executing a GET request: https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/Messages?$top=1&$select=id,subject,ourdomain_EmailCustomFields
Also, the following GET request gives me an error.
Request: https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/Messages?$filter=ourdomain_EmailCustomFields/MailID eq '12'
Response:
{
"error": {
"code": "RequestBroker--ParseUri",
"message": "Could not find a property named 'e2_someguid_ourdomain_EmailCustomFields' on type 'Microsoft.OutlookServices.Message'.",
"innerError": {
"request-id": "someguid",
"date": "2020-05-29T01:04:53"
}
}
}
Do you have any ideas on how to resolve the issues?
Thank you!
I took your schema extension and copied and pasted it into my tenant, except with a random app registration I created as owner. then patched an email with your statement, and it does work correctly.
A couple of things here,
I would verify using microsoft graph explorer that everything is correct. eg, log into graph explorer with an admin account https://developer.microsoft.com/en-us/graph/graph-explorer#
first make sure the schema extensions exists
run a get request for
https://graph.microsoft.com/v1.0/schemaExtensions/DOMAIN_EmailCustomFields
It should return the schemaextension you created.
then
Run a get request for the actual message you patched not all messages that you filtered for now.
https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/Messages/MESSAGEID?$select=DOMAIN_EmailCustomFields
here the response should be the email you patched and your EmailCustomField should be in the data somewhere, if it is not, that means that your patch did not work.
then you can run patch again from graph explorer
I did all this from graph explorer, easiest way to confirm.
two other things,
1) maybe the ?$top=1 in your get first message isn't the same message that you patched?
2) as per the documentation, you cannot use $filter for schema extensions with the message entity. (https://learn.microsoft.com/en-us/graph/known-issues#filtering-on-schema-extension-properties-not-supported-on-all-entity-types) So that second Get will never work.
Hopefully this helps you troubleshoot.
I had originally created in my solr schema 3 copy fields:
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-copy-field": {"source":"company_name","dest":"_text_"}}' http://my-instance/solr/listing/schema
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-copy-field": {"source":"address","dest":"_text_"}}' http://my-instance/solr/listing/schema
curl -X POST -H 'Content-type:application/json' --data-binary '{"add-copy-field": {"source":"city","dest":"_text_"}}' http://my-instance/solr/listing/schema
However, I have recently removed these from the schema and are now composing queries in a slightly different format. More advanced queries we have the need for edismax.
However, even by turning on edismax I'm receiving an error from the solr query parser as per below. Did I break something by deleting the copy fields?
/solr/listing/select?debugQuery=on&defType=edismax&q=%3A&stopwords=true
{
"responseHeader": {
"zkConnected": true,
"status": 400,
"QTime": 1,
"params": {
"q": "*:*",
"defType": "edismax",
"debugQuery": "on",
"stopwords": "true"
}
},
"error": {
"metadata": [
"error-class",
"org.apache.solr.common.SolrException",
"root-error-class",
"org.apache.solr.common.SolrException"
],
"msg": "org.apache.solr.search.SyntaxError: Query Field '_text_' is not a valid field name",
"code": 400
}
}
As per the comments the 'text' field remains in 3 places in the config:
"/update/extract":{
"startup":"lazy",
"name":"/update/extract",
"class":"solr.extraction.ExtractingRequestHandler",
"defaults":{
"lowernames":"true",
"fmap.content":"_text_"}}
"spellchecker":{
"name":"default",
"field":"_text_",
"initParams":[{
"path":"/update/**,/query,/select,/tvrh,/elevate,/spell,/browse",
"defaults":{"df":"_text_"}}]
As per the comment on my question (I'm still on the learning path of solr):
Although they have been deprecated for quite some time, Solr still has
support for Schema based configuration of a <defaultSearchField/>
(which is superseded by the df parameter) and <solrQueryParser defaultOperator="OR"/> (which is superseded by the q.op parameter.
If you have these options specified in your Schema, you are strongly
encouraged to replace them with request parameters (or request
parameter defaults) as support for them may be removed from future
Solr release.
For our purposes and as we are using the edismax query parser we needed to specify the query fields that we wanted to use.
2+ year old post, not sure this will help.
Since you are using "defType": "edismax"
try "q.alt": "*:*" instead of "q": "*:*". This should fix the issue.
I am using ektorp 1.4.1 Jar to connect to Cloudant database. Now I am able to write map and reduce functions using class EventRepository extends CouchDbRepositorySupport. But my problem here is, how I can query for Index and Selector using ektorp java API? Please help me out here by any one. Thanks in advance.
This is my Query Index :
{
"index": {
"fields": [
{"name": "userName", "type": "string"}
]
},
"type": "text"
}
and here is my selector code for getting all Events from cloudant by User Name Descending order by startDate.
{
"selector": {
"userName": "vekusuma#in.ibm.com"
},
"fields": [
"userName",
"startDate",
"days",
"_id",
"_rev"
],
"sort": [
{
"userName": "desc"
}
]
}
I am using the below code to connect cloudant using Cloudant java API...
CloudantClient client = ClientBuilder.url(new URL("https://userName:password#*****.cloudant.com")).username("*******").
password("*******").build();
List<String> dbsList = client.getAllDbs();
System.out.println("...dbsList size is :: " + dbsList.size());
CloudantClient client = ClientBuilder.account("username").username("username").password("password").
build();
but still same issue...
and even I have tried in different way...
... and I am getting below mentioned error while running on Eclipse Websphere server 7.0 on local...
***********Error*************
[3/9/16 23:53:43:547 IST] 00000031 SystemErr R com.cloudant.client.org.lightcouch.CouchDbException: 400 Bad request: 400 Bad request
Your browser sent an invalid request.
[3/9/16 23:53:43:548 IST] 00000031 SystemErr R at com.cloudant.client.org.lightcouch.CouchDbClient.execute(CouchDbClient.java:501)
Plz help me some thing here... Thanks in advance :)
From my (quick) reading of the ektorp API, it doesn't support Cloudant Query, (the product name for query). However there is a Official Cloudant java library which does support the Cloudant Query endpoints.
I using solr 4.6.1, I have one problem in searching string with special charcters, let me tell you one example
if I search string "choose:" then results having string <choose> comes first and then results with exact match <choose:> comes at the end of result set.
Please tell me what I have to do to solve this problem.
"params": {
"lowercaseOperators": "true",
"indent": "true",
"q": "type:service AND tags:\"choose:\"",
"qf": "tags^8",
"_": "1406201797319",
"stopwords": "true",
"wt": "json",
"defType": "edismax"
}
If you search against a StrField, only exact matches will count. You can then score these matches higher, using qf=exact^8 text (if using dismax or edismax as your query parser). In standard Lucene syntax you can search for exact:"choose:"^8 OR text:"choose:" to score the exact matches higher.