0

I am running a single node with ElasticSearch (1.4.4) and I have two indexes with the same documents indexed. The only difference is in the number of shards:

  • Index 1: 5 shards, 0 replicas
  • Index 2: 1 shard, 0 replicas

When I run a test of 100 different queries using the Java API, I get different results for each index. I have tried using DFS Query Then Fetch for both of them, but I still get different results.

I am wondering what's happening. I am not sure how elasticsearch is performing the queries in order to get different results.

UPDATE:

These are the settings and mappings for my indexes:

"settings": {
      "number_of_shards" :   1, // or 5 for the other index
      "number_of_replicas" : 0,
      "analysis": {
               "filter": {
                  "worddelimiter": {
                     "type": "word_delimiter"
                  }
               },
               "analyzer": {
                  "custom_analyzer": {
                     "type": "custom",
                     "filter": [
                        "lowercase",
                        "asciifolding",
                        "worddelimiter"
                     ],
                     "tokenizer": "standard"
                  }
               }
            }
  }

"mappings": {
     "faq": {
        "properties": {
           "answer": {
              "type": "string",
              "analyzer": "custom_analyzer"
           },
           "answer_id": {
              "type": "long"
           },
           "path": {
              "type": "string",
              "analyzer": "custom_analyzer"
           },
           "question": {
              "type": "string",
              "analyzer": "custom_analyzer"
           }
        }
     }
  }

And this is the query:

client.prepareSearch(index)
                    .setTypes(type)
                    .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) 
                    .setQuery(QueryBuilders.multiMatchQuery(inputText, "questions","answer^2","paths")
                    .setSize(BUFFER_SIZE)
                    .setFrom(i * BUFFER_SIZE)
                    .execute()
                    .actionGet();
5
  • Can you elaborate about the results differences and what do your index contain? Commented Mar 6, 2015 at 13:27
  • If you are doing aggregations with flat data you can get this behavior. What kinds of queries are giving you different results? Commented Mar 6, 2015 at 16:16
  • I have updated the post with more information about the indexes and the query. Commented Mar 9, 2015 at 9:15
  • what is BUFFER_SIZE value ? and how many results do you get ? Commented May 31, 2015 at 10:01
  • Are you using "preference" in your search to get results from the same shards for each search. See my answer at stackoverflow.com/a/54478881/645042 Commented Feb 1, 2019 at 11:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.