Fulltext search in different datatypes (different indexes)


(Ulrik Pedersen) #1

Our usecase is a webapp with a Google like search page where people can search in a single query field.

The data source is different database tables but with some fields recurring in the different tables.

eg.

{
  "index_1": {
    "mappings": {
      "_doc": {
        "properties": {
          "DATE": {
            "type": "date"
          },
          "NAME": {
            "type": "text"
            }
          },
          "NOTIFICATION": {
            "type": "text"
            }
          },
          "IDENTIFICATION": {
            "type": "text"
            }
          },
          "PRIORITY": {
            "type": "keyword"
          }
       }
     }
   },
  "index_2": {
    "mappings": {
      "_doc": {
        "properties": {
          "DATE": {
            "type": "date"
          },
          "NAME": {
            "type": "text"
            }
          },
          "LOCATION": {
            "type": "text"
            }
          },
          "DESCRIPTION": {
            "type": "text"
            }
          },
          "PRIORITY": {
            "type": "keyword"
          }
       }
     }
   }
}

Right now the results when searching in the above for eg. NAME scores the documents from one of the indexes higher than the other, even though NAME is not exactly represented in that index but maybe exactly represented in the other. I had a look in the scoring explaination and the first index scores significantly higher than the other.

Would it be better to merge the datatables into one ES index and then add a field to keep track of the original datasource.

The search query is designed like this:

GET index_*/_search


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.