Elasticsearch by geo location only if document has location - search

I currently query documents from Elasticsearch with the standard geo_distance filter within Xmi of a pair of coordinates. Now here's where I'd like to improve: I also want to index documents WITHOUT a location and also include them in the search but not filter them by distance.
Is this possible or out of reach with Elasticsearch? Essentially, if a document has a location lets filter it and find ones nearby. Otherwise, just search the documents without location normally.

Try using a Bool filter wrapping the geo_distance filter with a Missing filter both as should

Related

Azure Cognitive Search: How to boost a filter

In Azure Search you can boost a query by using first term || secondterm^2 to give more weight to a particular part of the query.
You can also filter for documents that belong to a particular group using search.in(): https://learn.microsoft.com/en-us/azure/search/search-query-odata-search-in-function
$filter=group_ids/any(g: search.in(g, '123, 456, 789'))
What I would like to do is boost a document if it belongs to a group but not restrict to only documents that belong to that group.
Something like:
search=mysearchterm^3&$filter=group_ids/any(g: search.in(g, '123, 456, 789'))^2
But (1) boosting on the filter doesn't seem to work and (2) this would restrict to only documents that belong to group 123,456,789. I would like it to only boost if it belongs, but not restrict to only those groups.
Is this possible?
I've had a look at "Tag Boosting": https://azure.microsoft.com/en-au/blog/personalizing-search-results-announcing-tag-boosting-in-azure-search/
But it doesn't seem relevant, it only seems possible to tag boost a top level string field, not a string or int field within a collection.
UPDATE:
I think i've figured it out as:
search=mysearchterm AND (group_id:123)^2
If you're using a complex collection it might be:
search=mysearchterm AND (groups/id:123)^2
Filters are designed to constrain your result set by filtering out documents that don't match the filter criteria. This process happens before term matching and scoring. Given that this is not what you are trying to do, I don't think filters are the right tools for the job.
You can try to instead craft a Lucene query that includes the logic you described:
mysearchterm OR (mysearchterm AND group_ids:(123 OR 456 OR 789))^2

Find logs which not contains specified field in kibana

I use ELK to arrange my logs, logs goes from many places and some records might not contain several fields and the question is what is the best way to find such records? Can I find logs which not contains several fields?
Kibana uses the query string query syntax of Elasticsearch in its filters. The syntax to find a document that does not have a given field is _missing_:FIELD_NAME. The + operator is the preferred way to ensure that a particular search term must be present in the matched documents. Combining these two will allow you to search for documents that are missing multiple fields:
+_missing_:foo +_missing_:bar +_missing_:baz

Implement Search Everything using Solr

How the search everything kind of application is indexing & keeping track of data into its search indexes.
Recently I have been working on Apache Solr which is producing amazing results for a search. But it was for one particular products catalog section that is being searched. As Solr is a stores it's data document, we indexed searchable fields as document in solr. I'm not sure how it can be used to build a search everything kind of search? And how should I index data into Solr?
By search everything I mean, to search into different module for information like Customers, Services, Accounts, Orders, Catalog, Support Ticket, etc. So search return results which is combined as a result from a single search form and user don't need to go into different forms for search that module?
Do I need to build different indexes for each such data models or store them into solr as single document? What is the best strategy to implement this.
You can store all that data in a single index with each document having an extra field that stores its type (Customer, Order, etc.). For the within-module search, just restrict the search query to documents of that type. For the Search All functionality, use copyField to copy all the relevant fields in each document type into one big field, and search with the document type field unconstrained.

Lower case and Upper case in Solr keyword

Im using Solr 3.5.0, and in Schema I have enabled the LowerCaseFilterFactory in all needed fields, bbut When I search for example "shirts" im able to get the results, also when I search for "SHIRTS" i'm able to get expected results, but when I try to search with "shiRTs" its not giving the results. I know I'm missing some thing in Schema.
Please help me on this.
Thanks
Jeyaprakash.
Apply the same analysers and filters at both index and query time, so the the queries you search for match the tokens index.
As in your case -
If you apply the Lower case filter at index time but not at query time :-
Index token will be shirts, However as the search query is not analyzed SHIRTS or even Shirts will not match indexed shirts token.
The same would apply if you are using stemmers, stopwords or other filters.
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#Analyzers
Analyzers are components that pre-process input text at index time
and/or at search time. It's important to use the same or similar
analyzers that process text in a compatible manner at index and query
time. For example, if an indexing analyzer lowercases words, then the
query analyzer should do the same to enable finding the indexed words.

How can I configure Sitecore search to retrieve custom values from the search index

I am using the AdvancedDatabaseCrawler as a base for my search page. I have configured it so that I can search for what I want and it is very fast. The problem is that as soon as you want to do anything with the search results that requires accessing field values the performance goes through the roof.
The main search results part is fine as even if there are 1000 results returned from the search I am only showing 10 or 20 results per page which means I only have to retrieve 10 or 20 items. However in the sidebar I am listing out various filtering options with the number or results associated with each filtering option (eBay style). In order to retrieve these filter options I perform a relationship search based on the search results. Since the search results only contain SkinnyItems it has to call GetItem() on every single result to get the actual item in order to get the value that I'm filtering by. In other words it will call Database.GetItem(id) 1000 times! Obviously that is not terribly efficient.
Am I missing something here? Is there any way to configure Sitecore search to retrieve custom values from the search index? If I can search for the values in the index why can't I also retrieve them? If I can't, how else can I process the results without getting each individual item from the database?
Here is an idea of the functionality that I’m after: http://cameras.shop.ebay.com.au/Digital-Cameras-/31388/i.html
Klaus answered on SDN: use facetting with Apache Solr or similar.
http://sdn.sitecore.net/SDN5/Forum/ShowPost.aspx?PostID=35618
I've currently resolved this by defining dynamic fields for every field that I will need to filter by or return in the search result collection. That way I can achieve the facetted searching that is required without needing to grab field values from the database. I'm assuming that by adding the dynamic fields we are taking a performance hit when rebuilding the index. But I can live with that.
In the future we'll probably look at utilizing a product like Apache Solr.

Resources